Skip to content

Instantly share code, notes, and snippets.

@vpnwall-services
Last active July 20, 2023 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vpnwall-services/21039733ae3f3cae263a8ea4ac852d50 to your computer and use it in GitHub Desktop.
Save vpnwall-services/21039733ae3f3cae263a8ea4ac852d50 to your computer and use it in GitHub Desktop.
[SALTSTACK 101] SALTSTACK 101 #linux #saltstack #salt-minion #salt-master #reactor #pillar #formula

SALTSTACK 101

  • Setup minion conf
# /etc/salt/minion
master: xxx.xxx.xxx.xxx
master_port: 4506
  • Setup minion mine
/etc/salt/minion.d/mine.conf
mine_functions:
   test.ping: []
   network.interfaces: []
   network.ip_addrs:
     - ens4
   mine_interval: 2
  • Setup master
# /etc/salt/master
interface: xxx.xxx.xxx.xxx
publish_port: 4505
user: root
ret_port: 4506
conf_file: /etc/salt/master
pki_dir: /etc/salt/pki/master
autosign_grains_dir: /etc/salt/autosign_grains
file_roots:
  base:
    - /srv/salt/
    - /srv/formulas/hostsfile-formula/hostsfile
reactor:
  - /srv/reactor/start.sls
  • Setup autosign key #also pre-configure minion with this grain /etc/salt/grains
# /etc/salt/autosign_grains/auto_accept_key
randomstringofthedead
  • Setup reactor
# /srv/reactor/start.sls
base:
   local.state.sls:
     - tgt: '*'
     - arg:
         - states.init
  • Setup states
# /srv/salt/states/init.sls
this_action:
   cmd.run:
      - name: touch /tmp/log.txt
  • Pull formula mkdir /srv/formulas;cd /srv/formulas;git clone https://github.com/saltstack-formulas/hostsfile-formula

  • Start master with debug salt-master --log-level=trace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment