My personal salt states
- Available roles
- Understanding directory tree
- Configuration for salt master
- Configuration for salt minions
- Applying salt states
- console-admin
- console-developer
- docker-admin
- laptop
- workstation
- openqa-webui
- openqa-worker
- salt-master
- Each role has its own directory.
user@pc:~$ sudo salt '*' state.apply console-admin- Each role may install several packages.
- When a package configuration is also managed by salt, the package gets its own subdirectory (e.g. under the role directory).
user@pc:~$ sudo salt '*' state.apply workstation.shutter- States shared between different roles or states have their own directory
user@pc:~$ sudo salt '*' state.apply software-for-life.repository_addedMy salt master is a Raspberry Pi 2 model B with openSUSE Tumbleweed.
A hostname, that will be used by the minions, needs to be set. I chose the name rpi2b.
Then, the package binary-sequence-salt-master (not yet available) needs to be installed.
The package will install the salt-states and a top.sls file on the /srv/salt/ directory. If the salt-master is going to have more configuration on the top.sls file, only the salt states can be installed: binary-sequence-salt-states (not yet available).
These packages are not available in the official repositories, so the personal repo needs to be added:
user@pc:~$ sudo zypper addrepo <not yet available> binary-sequence
user@pc:~$ sudo zypper install binary-sequence:binary-sequence-salt-masterBy default, salt-minions expect the salt-master to have the hostname salt. Since I am using rpi2b, this have to be configured on each minion on its configuration file.
/etc/salt/minion
# ... other configuration ...
# Set the location of the salt master server. If the master server cannot be
# resolved, then the minion will fail to start.
master: rpi2b
# ... other configuration ...Then, I have the following minions with different roles:
/etc/salt/grains
roles:
- salt-master
- console-admin
- console-developer/etc/salt/grains
roles:
- console-admin
- console-developer
- docker-admin
- workstation
- openqa-webui
- openqa-worker/etc/salt/grains
roles:
- console-admin
- console-developer
- docker-admin
- workstation
- laptop/etc/salt/grains
roles:
- console-admin
- console-developer
- docker-admin
- workstation
- openqa-webui
- openqa-worker
- laptopOnce the master and the minions are properly configured, the services have to be enabled and started:
sergio@rpi2b:~$ sudo systemctl enable --now salt-master.service
sergio@rpi2b:~$ sudo systemctl enable --now salt-minion.servicesergio@eva-leap15:~$ sudo systemctl enable --now salt-minion.servicesergio@adam-tw:~$ sudo systemctl enable --now salt-minion.servicesergio@sergio-latitude:~$ sudo systemctl enable --now salt-minion.serviceThen, the states can be applied with the following command:
sergio@rpi2b:~$ sudo salt '*' state.apply