Skip to content

Instantly share code, notes, and snippets.

@btorch
Last active August 29, 2015 14:03
Show Gist options
  • Save btorch/7d880c661fa8ac54bc8a to your computer and use it in GitHub Desktop.
Save btorch/7d880c661fa8ac54bc8a to your computer and use it in GitHub Desktop.
Helpful Referecens that I use all the time
- http://salt.readthedocs.org/en/v0.17.5/ref/modules/all/ (builtin execution modules)
- http://salt.readthedocs.org/en/v0.17.5/ref/states/all/ (builtin state modules)
Note: Change the version above on the URL accordingly
builtin execution modules:
Those I normally used when executing a salt cli command such as the examples below
builtin state modules:
Those are normally used when writing/creating a state file
========================================
Useful salt CLI Flags
========================================
-t TIMEOUT, --timeout=
-b BATCH, --batch=BATCH, --batch-size=BATCH
--out=OUTPUT, --output=OUTPUT
* Depending what I'm retrieving from several minions I sometimes use --out=txt so I can get one liners back that can be compared
===============================================
- Using Grain target & grains execution module
===============================================
$ salt -t 15 -G 'stype:data' --out=txt grains.item roles
========================================
- Compound with grains (G)
===============================================
$ salt -t 10 -C "G@roles:account and G@stype:synnex"
==============================================
- Move roles grain from minion to grains file
==============================================
sudo salt '*' --out=txt grains.append roles nada
sudo salt '*' cmd.run "sed -i -e '/roles/,+10d' /etc/salt/minion"
sudo salt '*' --out=txt grains.remove roles nada
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment