Wednesday, October 6, 2021

thumbnail

Saltstack server side commands

Saltstack configuration Management command from salt-master 



1. switch to saltadmin and perform salt configuration management changes.

2. state files contains all the configuration file that push to the salt-minion. refer the following command to get that details.

#  pwd
/srv/salt
# ls
etc  _files  _modules  _pillar  RCS  _states  var

3. to create node group then use the following command

# cd /srv/salt/etc/master.d
# vi devservers.conf
---
#
# List of Dev Servers

nodegroups:
  devsrv:
    - dev-vm1.acg.com
    - dev-vm2.acg.com

4. To push any state files to the note group you can use the following command. you need to have the sshusers file under ~/_states folder to push that to the dev servers

# salt -N <node-group-name> state.apply sshusers
# salt -N devsrv state.apply sshusers

5. To check reachability of all the servers in the node group you can use the following command

# salt -N devsrv test.ping

6. To check the ping for single host you can use the following command

# salt dev-vm1.acg.com test.ping
# salt dev-vm1* state.highstate
# salt dev-vm1* state.apply devservers.sshusers (here devservers is the folder under_states and then sshusers exist there)

7. top.sls is the file which all the clients talks to and overwrite the configuration per that. so make sure if you make any changes update that.

# cd /srv/salt/_states/top.sls
---

base:
  # All minions get the following three state files applied
  '*':
    - dnsclient
    - saltstack-patch
    - motd
    # - ntpd
    # - smtp
    - salt-agent
    # - check_mk
    # (not required) - services
    # - post-grains

  devsrv:
    - match: nodegroup
    - nisclient
    - pam
    - root_crontab
    - sshd-server
    - devsrv-sshusers
    - devsrv-automount
- salt-minion
(similarly add for other nodegroups)

8. If you have two salt-master (meaning master and slave) then if you make any update to states and files then to sync that to the another salt-master (or slave) use the following command

# sync-states
# sync-files



Subscribe by Email

Follow Updates Articles from This Blog via Email

No Comments

Powered by Blogger.