# Salt Notes.md Salt is the configuration management tool --- My first section 02/02/2020 Deploying Salt event monitoring for Splunk 1. push new git files 2. sync_all 3. refresh_pillar 4. salt state for updating minions config --- Custom grains 10/20/2019 `_grains/mdr_environment.py` This file discovers which aws account the ec2 instnace is in. grain is called `dr_environment` but it is broken on salt master, the minion has a static file `/etc/salt/grains` `saltutil.sync_grains` ERROR: Could not get AWS connection: global name 'boto3' is not defined SOLUTION: see Salt Upgrade Notes.md -------- Highstate 11/20/2019 Cron job for state.apply ( DISABLED DURING REFACTOR ) salt manages a cron job on the master -------- salt-minion reactor when a salt-minion restarts the reactor kicks off a state.apply. This causes a notification when the salt-minion starts up and you try to apply a state. -------- gitfs lock file /var/cache/salt/master/gitfs/gitfs-base-msoc/.git/update.lk -------- Test salt master Switch branch on test salt-master for testing salt-run fileserver.update salt-run fileserver.file_list | grep mystuff ## Testing git branches using environments: You can use a different git branch for testing by specifying an environment to salt: ``` sudo salt-run fileserver.update # Refresh from git salt target saltutil.sync_all saltenv=mybranchname salt target state.sls mytestsls saltenv=mybranchname ``` ## Bringing on a new minion You probably want the grains synchronized before the minion is pushed to highstate. After accepting the key, run: ``` salt '*' saltutil.sync_grains salt '*' saltutil.sync_all ``` We can do this via a reactor. See https://docs.saltstack.com/en/latest/topics/reactor/index.html#minion-start-reactor