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

Installation and Configuration

Installation (Ubuntu example)

1. Install the SaltStack repo and key: ```wget -O - https://repo.saltstack.com/apt/ubuntu/18.04/amd64/latest/SALTSTACK-GPG-KEY.pub | sudo apt-key add -``
2. save ```/etc/apt/sources.list.d/saltstack.list``` to ```deb http://repo.saltstack.com/apt/ubuntu/18.04/amd64/latest bionic main```
3. Install the needed Salt components using apt-get
    1. salt-master, salt-minion, salt-ssh, salt-api

Configuration