Salt: Difference between revisions
From DWIKI
m (→FAQ) |
|||
Line 30: | Line 30: | ||
salt '*' cmd.run "yum check-update > /dev/null;echo $?" | salt '*' cmd.run "yum check-update > /dev/null;echo $?" | ||
==Add minion to master== | ==Add minion to master== | ||
On client: | |||
set master in /etc/salt/minion, maybe also define some role(s) | |||
restart salt-minion | |||
On master: | |||
salt-key | |||
if hostnamed indeed shows up, | |||
salt-key -a hostname | |||
and then | |||
salt hostname state.highstate | |||
==single line per minion== | ==single line per minion== |
Revision as of 09:01, 24 August 2016
Salt Configuration Management
Links
- Homepage
- Documentation
- Getting Started with Salt Stack
- An Introduction to SaltStack Terminology and Concepts
- Managing Linux server configs with the SaltStack
- Cheat Sheet
- Cheat sheet 2
- Salt - Beginners Tutorial
- https://rizvir.com/articles/saltstack/
Tools
Writing custom state modules
- https://docs.saltstack.com/en/latest/ref/states/writing.html
- http://intothesaltmine.readthedocs.io/en/latest/chapters/development/writing-modules.html
Syntax checking etc:
python -m py__compile mymodule.py
saltutil.sync_states
FAQ
check if minion has packages to update
salt '*' cmd.run "yum check-update > /dev/null;echo $?"
Add minion to master
On client:
set master in /etc/salt/minion, maybe also define some role(s) restart salt-minion
On master:
salt-key
if hostnamed indeed shows up,
salt-key -a hostname
and then
salt hostname state.highstate
single line per minion
salt "*" grains.item nodename group os osrelease --out=txt
(for a list of items use grains.items
Apply just one part of role
Assuming you have foo.sls in roles/
salt '*' state.apply roles.myrole.foo
Change minion hostname
On minion:
- hostname new.host.name
- update /etc/hostname
- update /etc/salt/minion_id
- restart salt-minion
On master: rename the key ( /srv/salt/pki/master/minions/old.host.name )
Rendering SLS 'base:roles.foo.bar' failed: Jinja variable 'dict object' has no attribute 'blergh'
Unless you made a typo, your minion probably doesn't have access in pillar
multiple parameters
salt '*' param1,param2 arg1,arg2