Salt Configuration
Management
SaltStack.com
Salt Marketing Points
● Simplicity - Basic Architecture
● Parallel execution
● Secure encryption / authentication
● Open Source: https://github.com/saltstack/salt
Architecture
● Salt master: the central management
system.
● Salt minion: a managed system.
Execute Commands
● salt ‘*’ cmd.run ‘ls -l /etc’
● salt ‘*’ disk.usage
● salt ‘*’ network.interfaces
Salt Command Syntax
Synopsis
salt <target> <module.function> <arguments>
Flags
-E
--pcre
Perl Compatible Reg. Exp. to match on minion name
-G
--grain
Allows targeting by matching predefined values in minion machines
-C
--compound
Allows combining criteria
Targeting
● salt ‘minion1’ disk.usage
● salt ‘minion*’ disk.usage
● salt -G ‘os:Ubuntu’ test.ping
● salt -E ‘minion[0-9]’ test.ping
● salt -C ‘G@os:Ubuntu and minion*’ test.ping
More definitions...
● Salt States - Scripts that use predefined functions that are run against minions
and tracked - preventing them from running
multiple times.
● Top File - Configures which files to run against which minions
Predefined Functions?!? I want to do more
Functions are just Python methods
sorted into modules. You can write your
own if you need to do anything too
complicated or you can be lazy:
https://github.com/saltstack-formulas
Sample Modules
on GitHub
● Docker
● Jenkins
● Wordpress
● Apache
● mySQL
● Node
● ...even Salt
Pillar
Data assigned to minions using targets
Think configurations for a machine
i.e. Ports, Usernames, Passwords, etc.
Configure different machines to look at different
environments, hostnames, etc.
Applied by template or specified manually:
salt '*' state.apply ftpsync pillar='{"ftpusername": "test"}’
Includes
DRY applies here too
EX top of salt state:
include:
- mercurial
Ordering & Requisites
Things happen in order from the top file or based on includes…
To get fancy you can have the following:
Jinja - Magic Conditionals
Want to make Pillars more than statically assigned to minions?
Refresh the pillar variables and use them in a state file
What about my data or modifying files?
5 More Slides… Events
What kind of things can you get notified of
● Periodic Presence Updates - which minions are connected
● Minion Connected
● Minion Disconnnected
● State Completion
● Custom
○ Salt-call event.send /my/test/event ‘{“data”: “my test event”}’
Beacons
Trigger events for non-salt related things
● File System Changes
● System Load
● Service Status
● Shell Activity (user login)
● Network and Disk Usage
Reacting to Events
References
● https://docs.saltstack.com/en/getstarted/index.html
● https://docs.saltstack.com/en/latest/contents.html
● https://linux.die.net/man/1/salt
● https://github.com/saltstack/salt
● https://github.com/saltstack-formulas
● Images stolen shamelessly from Google Image Search

SaltStack Configuration Management

  • 1.
  • 2.
    Salt Marketing Points ●Simplicity - Basic Architecture ● Parallel execution ● Secure encryption / authentication ● Open Source: https://github.com/saltstack/salt
  • 3.
    Architecture ● Salt master:the central management system. ● Salt minion: a managed system.
  • 4.
    Execute Commands ● salt‘*’ cmd.run ‘ls -l /etc’ ● salt ‘*’ disk.usage ● salt ‘*’ network.interfaces
  • 5.
    Salt Command Syntax Synopsis salt<target> <module.function> <arguments> Flags -E --pcre Perl Compatible Reg. Exp. to match on minion name -G --grain Allows targeting by matching predefined values in minion machines -C --compound Allows combining criteria
  • 6.
    Targeting ● salt ‘minion1’disk.usage ● salt ‘minion*’ disk.usage ● salt -G ‘os:Ubuntu’ test.ping ● salt -E ‘minion[0-9]’ test.ping ● salt -C ‘G@os:Ubuntu and minion*’ test.ping
  • 8.
    More definitions... ● SaltStates - Scripts that use predefined functions that are run against minions and tracked - preventing them from running multiple times. ● Top File - Configures which files to run against which minions
  • 9.
    Predefined Functions?!? Iwant to do more Functions are just Python methods sorted into modules. You can write your own if you need to do anything too complicated or you can be lazy: https://github.com/saltstack-formulas
  • 10.
    Sample Modules on GitHub ●Docker ● Jenkins ● Wordpress ● Apache ● mySQL ● Node ● ...even Salt
  • 11.
    Pillar Data assigned tominions using targets Think configurations for a machine i.e. Ports, Usernames, Passwords, etc. Configure different machines to look at different environments, hostnames, etc. Applied by template or specified manually: salt '*' state.apply ftpsync pillar='{"ftpusername": "test"}’
  • 12.
    Includes DRY applies heretoo EX top of salt state: include: - mercurial
  • 13.
    Ordering & Requisites Thingshappen in order from the top file or based on includes… To get fancy you can have the following:
  • 14.
    Jinja - MagicConditionals Want to make Pillars more than statically assigned to minions? Refresh the pillar variables and use them in a state file
  • 15.
    What about mydata or modifying files?
  • 16.
    5 More Slides…Events What kind of things can you get notified of ● Periodic Presence Updates - which minions are connected ● Minion Connected ● Minion Disconnnected ● State Completion ● Custom ○ Salt-call event.send /my/test/event ‘{“data”: “my test event”}’
  • 17.
    Beacons Trigger events fornon-salt related things ● File System Changes ● System Load ● Service Status ● Shell Activity (user login) ● Network and Disk Usage
  • 18.
  • 20.
    References ● https://docs.saltstack.com/en/getstarted/index.html ● https://docs.saltstack.com/en/latest/contents.html ●https://linux.die.net/man/1/salt ● https://github.com/saltstack/salt ● https://github.com/saltstack-formulas ● Images stolen shamelessly from Google Image Search

Editor's Notes

  • #3 The 30 second summary Salt is: a configuration management system, capable of maintaining remote nodes in defined states (for example, ensuring that specific packages are installed and specific services are running) a distributed remote execution system used to execute commands and query data on remote nodes, either individually or by arbitrary selection criteria
  • #5 But who runs commands on all of their systems?
  • #9 Tracks provisioned ‘version’ by knowing what states have been run on which minion by unique id