State Management¶
States apply specific configurations to minions. See State Reference.
Any .sls
file in File Section will be evaluated as a SaLt State
file. Subdirectories can be referenced as packages via the dir name if there is
an init.sls
file present. Directories do not require .sls
files for
traversal.
salt '*' state.sls {STATE FILE NAME} saltenv=prod
salt-call state.sls {STATE FILE NAME} saltenv=prod
Any state files may be referenced in other state files, using dotted access notation from that environments root to access them.
ls -1 /srv/salt/static/prod/other/app/
init.sls
prod:
'my_host';
- other.app
Install a Package¶
apache2:
pkg:
- installed
Deploy File with Content from Server¶
ls -1 /srv/salt/static/prod/files/config
.bashrc
prod:
/root/.bashrc
file.managed:
- user: root
- group: root
- mode: 0600
- source: salt://files/config/.bashrc