saltstack configuration management

20
Salt Configuration Management SaltStack.com

Upload: nathan-sickler

Post on 19-Mar-2017

3.987 views

Category:

Engineering


5 download

TRANSCRIPT

Page 1: SaltStack Configuration Management

Salt Configuration ManagementSaltStack.com

Page 2: SaltStack Configuration Management

Salt Marketing Points

●Simplicity - Basic Architecture

●Parallel execution

●Secure encryption / authentication

●Open Source: https://github.com/saltstack/salt

Page 3: SaltStack Configuration Management

Architecture● Salt master: the central

management system.

● Salt minion: a managed system.

Page 4: SaltStack Configuration Management

Execute Commands●salt ‘*’ cmd.run ‘ls -l /etc’

●salt ‘*’ disk.usage

●salt ‘*’ network.interfaces

Page 5: SaltStack Configuration Management

Salt Command SyntaxSynopsissalt <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

Page 6: SaltStack Configuration Management

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

Page 7: SaltStack Configuration Management
Page 8: SaltStack Configuration Management

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

Page 9: SaltStack Configuration Management

Predefined Functions?!? I want to do moreFunctions 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

Page 10: SaltStack Configuration Management

Sample Modules on GitHub

● Docker

● Jenkins

● Wordpress

● Apache

● mySQL

● Node

● ...even Salt

Page 11: SaltStack Configuration Management

PillarData 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"}’

Page 12: SaltStack Configuration Management

IncludesDRY applies here too

EX top of salt state:

include: - mercurial

Page 13: SaltStack Configuration Management

Ordering & RequisitesThings happen in order from the top file or based on includes…

To get fancy you can have the following:

Page 14: SaltStack Configuration Management

Jinja - Magic ConditionalsWant to make Pillars more than statically assigned to minions?

Refresh the pillar variables and use them in a state file

Page 15: SaltStack Configuration Management

What about my data or modifying files?

Page 16: SaltStack Configuration Management

5 More Slides… EventsWhat 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”}’

Page 17: SaltStack Configuration Management

BeaconsTrigger events for non-salt related things

● File System Changes

● System Load

● Service Status

● Shell Activity (user login)

● Network and Disk Usage

Page 18: SaltStack Configuration Management

Reacting to Events

Page 19: SaltStack Configuration Management
Page 20: SaltStack Configuration Management

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