SaltStack commands

SaltStack services

  • master:

    service salt-master restart
    or
    service salt-master force-reload
    
  • minion:

    service salt-minion restart
    
  • salt API:

    service salt-api restart
    

Salt-master commands

  • listing minions keys:

    salt-key --list all
        Accepted Keys:
        Denied Keys:
        Unaccepted Keys:
        Rejected Keys:
    
  • accept all minions keys, y to force validation:

    salt-key -A
    
  • delete all minions key:

    salt-key -D
    
  • accept one of minions:

    salt-key -a <minionID>
    
  • ping all minions:

    salt '*' test.ping
    
  • ping one of minions:

    salt 'scribe.ac-test.fr' test.ping
    
  • run grains on all minions for retrieve network interface:

    salt "*" grains.get 'hwaddr_interfaces'
    
  • run grains on all minions for retrieve CPU model:

    salt "*" grains.get 'cpu_model'
    
  • run OS command on minion:

    salt "*" cmd.run 'reboot'
    
  • listing modules:

    salt-call sys.list_modules --out=json
    
  • listing states:

    salt-call sys.list_state_modules
    
  • listing modules force output format:

    salt-call sys.list_modules --out=json
    
  • synchronising modules of the minions with the master:

    salt-call saltutil.sync_modules
    

this command is present in the /usr/share/eole/postservice/00-actions script.

  • launching a sls state (receip):

    salt 'local' state.sls schedule.manage
    
  • launching a sls state (receip) with the corresponding environment:

    salt 'local' state.sls schedule.manage saltenv=ead
    
  • debug master:

    /usr/bin/salt-master --log-file-level=quiet --log-level=debug
    
    tail -f /var/log/salt/master
    
    salt --versions-report
    

Salt-minion commands

  • declare 2 master on minion, edit /etc/salt/minion:

    master:
      - 127.0.0.1
      - eolebase
    
  • debug minion:

    service salt-minion status
    
    /usr/bin/salt-minion -d -c /etc/salt -l debug
    
    tail -f /var/log/salt/minion
    
    salt-call --versions-report