View on GitHub

presentations

Presentation notes from JMU Unix Users Group meetings

SaltStack


What is Configuration mangement?


Configration Management tools


About Salt


Architecture

Salt Architecture


Pillars and Grains


Execution Modules

Salt Execution Modules


States

network_utilities:
  pkg.installed:
    - pkgs:
      - rsync
      - curl

nginx_pkg:
  pkg.installed:
    - name: nginx

nginx_service:
  service.running:
    - name: nginx
    - enable: True
    - require:
      - pkg: nginx_pkg

Top File

base:
    # Applied to all servers
    '*':
        - universal_setp
    # Applied only to ubuntu servers
    'os:Ubuntu':
        - match: grain
        - ubuntu_setup
    # Applied only to web-server
    web-server:
        - apache_setup

Targeting Minions

salt minion1 test.ping
salt "minion*" test.ping
salt -L "minion1, minion2" test.ping
Salt -G 'os_family:windows' test.ping
salt -N windows_minions test.ping
nodegroups:
    windows_minions 'G@os_family:windows'

Event System

# Watch the event bus forever in a shell while-loop.
salt-run state.event | while read -r tag data; do
    echo $tag
    echo $data | jq --color-output .
done

Reactor


Salt Installation (Ubuntu Example)

  1. Run the following command to import the SaltStack repository key:
  wget -O - <https://repo.saltstack.com/apt/ubuntu/18.04/amd64/latest/SALTSTACK-GPG-KEY.pub> | sudo apt-key add -
  1. Save the following file to /etc/apt/sources.list.d/saltstack.list:
  deb http://repo.saltstack.com/apt/ubuntu/18.04/amd64/latest bionic main
  1. Run sudo apt-get update

  2. Install the salt-minion, salt-master, or other Salt components:

  sudo apt-get install salt-master
  sudo apt-get install salt-minion

Once installed all Salt components are controlled through systemd unit files


Salt master Configuration


Salt Minion Configuration