start playing with top.sls

- assign two minions the 'roles:web' grain
- create the 'cowsay' state
- match the 'vim' state to all minions
- match the 'cowsay' state to minions w/ 'roles:saltlab'
- match the 'nginx' state to minions w/ 'roles:web'
This commit is contained in:
John Bowdre 2023-03-24 17:12:03 -05:00
parent 8cbbe97d24
commit cd1d0eb462
5 changed files with 20 additions and 7 deletions

View file

@ -70,11 +70,7 @@ minion04:
True True
``` ```
And finally, as a treat, apply a [Salt state to install vim and my vimrc](srv/salt/vim/init.sls) on the minions with the `roles:saltlab` grain:
```shell
sudo salt -G 'roles:saltlab` state.apply vim
```
To blow it all away for a fresh start, just run `vagrant destroy -f`.
Happy Salting! Happy Salting!
## Cleanup
To blow it all away for a fresh start, just run `vagrant destroy -f`.

2
Vagrantfile vendored
View file

@ -56,6 +56,7 @@ EOF
grains: grains:
roles: roles:
- saltlab - saltlab
- web
EOF EOF
systemctl restart salt-minion systemctl restart salt-minion
SHELL SHELL
@ -99,6 +100,7 @@ EOF
grains: grains:
roles: roles:
- saltlab - saltlab
- web
EOF EOF
systemctl restart salt-minion systemctl restart salt-minion
SHELL SHELL

3
srv/salt/cowsay/init.sls Normal file
View file

@ -0,0 +1,3 @@
install_cowsay:
pkg.installed:
- name: cowsay

View file

@ -0,0 +1,3 @@
uninstall_cowsay:
pkg.removed:
- name: cowsay

9
srv/salt/top.sls Normal file
View file

@ -0,0 +1,9 @@
base:
'*':
- vim
'roles:saltlab':
- match: grain
- cowsay
'roles:web':
- match: grain
- nginx