Skip to content

binary-sequence/salt-states

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 

salt-states

My personal salt states

Index

  1. Available roles
  2. Understanding directory tree
  3. Configuration for salt master
  4. Configuration for salt minions
  5. Applying salt states

1. Available roles

  • console-admin
  • console-developer
  • docker-admin
  • laptop
  • workstation
  • openqa-webui
  • openqa-worker
  • salt-master

2. Understanding directory tree

  • 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_added

3. Configuration for salt master

My 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-master

4. Configuration for salt minions

By 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:

rpi2b

/etc/salt/grains

roles:
  - salt-master
  - console-admin
  - console-developer

eva-leap15

/etc/salt/grains

roles:
  - console-admin
  - console-developer
  - docker-admin
  - workstation
  - openqa-webui
  - openqa-worker

adam-tw

/etc/salt/grains

roles:
  - console-admin
  - console-developer
  - docker-admin
  - workstation
  - laptop

sergio-latitude

/etc/salt/grains

roles:
  - console-admin
  - console-developer
  - docker-admin
  - workstation
  - openqa-webui
  - openqa-worker
  - laptop

5. Applying salt states

Once 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.service
sergio@eva-leap15:~$ sudo systemctl enable --now salt-minion.service
sergio@adam-tw:~$ sudo systemctl enable --now salt-minion.service
sergio@sergio-latitude:~$ sudo systemctl enable --now salt-minion.service

Then, the states can be applied with the following command:

sergio@rpi2b:~$ sudo salt '*' state.apply

About

My personal salt states

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published