SaltStack – Brownbag
(Not) just another
Automation & Remote Execution Tool
Arnold Bechtoldt
Karlsruhe, 16.08.13
2
1.  Project
2.  Quickstart
3.  States
4.  Grains
5.  Pillar
6.  Modules
Agenda
3
‣  Was born in February, 2011
‣  Written in Python, Apache License v2
‣  Runs on Linux, Arch Linux, FreeBSD, OS X, Solar...
4
1.  Setting the repository source
Ø  deb http://debian.saltstack.com/debian wheezy-saltstack main
2.  Importing the pac...
5
4.  Make domain ‚salt‘ resolvable (Client)
Ø  echo “192.168.2.1 master.domain.de salt“ >> /etc/hosts
5.  Restart the cl...
6
‣  SaLt State File Tree (/srv/salt/):
§  top.sls
‣  postfix/
§  init.sls
§  satellite.sls
‣  files/
‣  etc/
‣  postfi...
development:
’mx-*’:
- postfix.satellite
development:
’webservers’:
- match: nodegroup
- apache
- curl
7
Salt States
top.s...
postfix:
pkg:
- installed
- names:
- postfix
- postfix-pcre
service:
- running
- require:
- pkg: postfix
- file: /etc/post...
/etc/postfix/main.cf:
file.managed:
- source: salt://postfix/files/etc/postfix/satellite.main.cf
- user: root
- group: pos...
...
myhostname = {{ grains[’fqdn’] }}
myorigin = $myhostname
inet_interfaces = {{ inet_interfaces }}
{% if use_postscreen ...
alias cmd cron svn disk
file gem git grains user
group mercurial hosts iptables kmod
libvirt locale lvm mdadm mongodb
moun...
12
Salt Grains
Static node-specific information (Puppet: Facts)
‣  Contain node-specific information like
•  BIOS (release...
‣  Node-specific information defined by the user
‣  Uses the same structure as SLS tree (top.sls, several environments, …)...
‣  To be used on the CLI (Master):
salt 
-L ‘web1.domain.de,web2.domain.de,web3.domain.de’ 
pkg.install 
name=foobar 
refr...
pkg alias apache timezone at
cmd cp cron debconf dig
disk dnsutil pip extfs file
gem git group logrotate mdadm
mongodb mou...
16
Vielen Dank für Ihre Aufmerksamkeit
Kontakt
Arnold Bechtoldt
Systems Engineer
inovex GmbH
Office Karlsruhe
Zur Gießerei...
Upcoming SlideShare
Loading in...5
×

SaltStack – (Not) just another Automation & Remote Execution Tool

981

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
981
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
25
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "SaltStack – (Not) just another Automation & Remote Execution Tool"

  1. 1. SaltStack – Brownbag (Not) just another Automation & Remote Execution Tool Arnold Bechtoldt Karlsruhe, 16.08.13
  2. 2. 2 1.  Project 2.  Quickstart 3.  States 4.  Grains 5.  Pillar 6.  Modules Agenda
  3. 3. 3 ‣  Was born in February, 2011 ‣  Written in Python, Apache License v2 ‣  Runs on Linux, Arch Linux, FreeBSD, OS X, Solaris, Windows ‣  > 10k commits, ~ 340 contributors, Top 10 of „GitHubs notable OSS“ (2012) ‣  Commercial support by the company behind SaltStack Project
  4. 4. 4 1.  Setting the repository source Ø  deb http://debian.saltstack.com/debian wheezy-saltstack main 2.  Importing the package signing key Ø  wget -q -O - "http://debian.saltstack.com/debian-salt-team- joehealy.gpg.key" | apt-key add - 3.  Updating the local cache & Installation of Salt Client + Master Ø  apt-get update && apt-get install salt-minion salt-master Quickstart Installation on Debian Wheezy
  5. 5. 5 4.  Make domain ‚salt‘ resolvable (Client) Ø  echo “192.168.2.1 master.domain.de salt“ >> /etc/hosts 5.  Restart the client (Client) Ø  service salt-minion restart 6.  Accept client‘s public key (Master) Ø  salt-key -a client.domain.de Quickstart Minimal Startup Configuration
  6. 6. 6 ‣  SaLt State File Tree (/srv/salt/): §  top.sls ‣  postfix/ §  init.sls §  satellite.sls ‣  files/ ‣  etc/ ‣  postfix/ §  satellite.main.cf Salt States Postfix Satellite Example
  7. 7. development: ’mx-*’: - postfix.satellite development: ’webservers’: - match: nodegroup - apache - curl 7 Salt States top.sls – Assigning nodes to SLS modules Environment Match nodes (hostname) Module Global defined group of nodes
  8. 8. postfix: pkg: - installed - names: - postfix - postfix-pcre service: - running - require: - pkg: postfix - file: /etc/postfix/main.cf 8 Salt States postfix/init.sls – Initial Module States Name Type Function Parameter
  9. 9. /etc/postfix/main.cf: file.managed: - source: salt://postfix/files/etc/postfix/satellite.main.cf - user: root - group: postfix - mode: 640 - require: - pkg: postfix 9 Salt States postfix/satellite.sls – Special Module States
  10. 10. ... myhostname = {{ grains[’fqdn’] }} myorigin = $myhostname inet_interfaces = {{ inet_interfaces }} {% if use_postscreen == True -%} postscreen_bare_newline_action = ignore postscreen_blacklist_action = drop {% endif %} ... 10 Salt States postfix/files/etc/postfix/satellite.main.cf – Configuration File Template
  11. 11. alias cmd cron svn disk file gem git grains user group mercurial hosts iptables kmod libvirt locale lvm mdadm mongodb mount mysql network pkg postgres quota selinux service ssh ... 11 Salt States Predefined SaltStack State Types (Puppet: Resources)
  12. 12. 12 Salt Grains Static node-specific information (Puppet: Facts) ‣  Contain node-specific information like •  BIOS (release, version) •  CPU (manufacturer, arch, model, flags) •  Hostname, Domain, FQDN •  LSB distribution / OS info (OS, codename, release, id, kernel type + version) •  IP configuration (Interfaces, IP addresses) •  Salt runtime environment data (version, $PATH, Python version, master) •  System type (virtual/ physical) ‣  Can be extended ‣  But do not have to: à Pillar
  13. 13. ‣  Node-specific information defined by the user ‣  Uses the same structure as SLS tree (top.sls, several environments, …) ‣  Provides the same targeting possibilities (globbing, regex, node groups, lists, grains) ‣  Will be sent to the client by the master during SLS execution only ‣  Simple YAML syntax 13 Salt Pillar Dynamic node-specific information
  14. 14. ‣  To be used on the CLI (Master): salt -L ‘web1.domain.de,web2.domain.de,web3.domain.de’ pkg.install name=foobar refresh=true fromrepo=wheezy-backports version=4.2 ‣  Or within SLS files: {% if salt[‘pkg.upgrade_available’](‘foobar’) == true %} 14 Salt Modules Remote Execution
  15. 15. pkg alias apache timezone at cmd cp cron debconf dig disk dnsutil pip extfs file gem git group logrotate mdadm mongodb mount mysql network service quota ps puppet S3 ssh solr tls tomcat user ... 15 Salt Modules Predefined SaltStack Modules
  16. 16. 16 Vielen Dank für Ihre Aufmerksamkeit Kontakt Arnold Bechtoldt Systems Engineer inovex GmbH Office Karlsruhe Zur Gießerei 16 76227 Karlsruhe +49 (173) 3181 117 arnold.bechtoldt@inovex.de
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×