Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Getting Started with SaltStack by Peter Baumgar...

PyCon 2014
April 11, 2014

Getting Started with SaltStack by Peter Baumgartner

PyCon 2014

April 11, 2014
Tweet

More Decks by PyCon 2014

Other Decks in Technology

Transcript

  1. “SaltStack delivers a dynamic infrastructure communication bus used for orchestration,

    remote execution, configuration management and much more.”
  2. Everything is Terrible Chef: knife, recipe, cookbook Puppet: terminus, metaparameters

    Ansible: playbook, inventory ! Salt might be the worst offender…
  3. Pil•lar ˈpilər (noun) Variables for one or more minions 


    (ports, file paths, configuration parameters)
  4. Installation Options Binaries for most distros Pip install (for bleeding

    edge) http://bootstrap.saltstack.org
 (it probably does what you want)
  5. Minion # apt-get install salt-minion # echo "salt 10.10.1.1" >>

    /etc/hosts # salt-key -a minion.lincolnloop.com Accept the minion key on the master Point minion to the master
  6. # salt 'myserver' state.highstate # salt-call state.highstate ...or pull from

    the minion Push from the master Highstate ...or master-less # salt-call state.highstate --local
  7. [INFO ] Loading fresh modules for state activity [INFO ]

    Running state [nginx] at time 13:12:03.314726 [INFO ] Executing state pkg.installed for nginx [INFO ] Executing command "dpkg-query --showformat='${Status} ${Package} $ {Version} ${Architecture}\n' -W" in directory '/home/pete' [INFO ] Executing command 'grep-available -F Provides -s Package,Provides -e "^.+ $"' in directory '/home/pete' [INFO ] Executing command 'apt-get -q update' in directory '/home/pete' [INFO ] Executing command ['apt-get', '-q', '-y', '-o', 'DPkg::Options::=--force- confold', '-o', 'DPkg::Options::=--force-confdef', 'install', 'nginx'] in directory '/home/pete' [INFO ] Executing command "dpkg-query --showformat='${Status} ${Package} $ {Version} ${Architecture}\n' -W" in directory '/home/pete' [INFO ] In stalled Packages: libgd3 changed from absent to 2.1.0-2 libxpm4 changed from absent to 1:3.5.10-1 ttf-dejavu-core changed from absent to 2.33+svn2514-3ubuntu1 nginx-common changed from absent to 1.4.1-3ubuntu1.3 libvpx1 changed from absent to 1.2.0-2 fonts-dejavu-core changed from absent to 2.33+svn2514-3ubuntu1 nginx-full changed from absent to 1.4.1-3ubuntu1.3 fontconfig-config changed from absent to 2.10.93-0ubuntu1 libxslt1.1 changed from absent to 1.1.28-2 libtiff5 changed from absent to 4.0.2-4ubuntu3 libjpeg-turbo8 changed from absent to 1.3.0-0ubuntu1.1 libjbig0 changed from absent to 2.0-2ubuntu1 nginx changed from absent to 1.4.1-3ubuntu1.3 libjpeg8 changed from absent to 8c-2ubuntu8 libfontconfig1 changed from absent to 2.10.93-0ubuntu1 ! [INFO ] Loading fresh modules for state activity [INFO ] Completed state [nginx] at time 13:13:32.491024
  8. local: ---------- ID: nginx Function: pkg.installed Result: True Comment: The

    following packages were installed/updated: nginx. Changes: ---------- fontconfig-config: ---------- new: 2.10.93-0ubuntu1 old: fonts-dejavu-core: ---------- new: 2.33+svn2514-3ubuntu1 old: libfontconfig1: ---------- new: 2.10.93-0ubuntu1 old: libgd3: ---------- new: 2.1.0-2 old: libjbig0: ---------- new: 2.0-2ubuntu1 old:
  9. libjpeg-turbo8: ---------- new: 1.3.0-0ubuntu1.1 old: libjpeg8: ---------- new: 8c-2ubuntu8 old:

    libtiff5: ---------- new: 4.0.2-4ubuntu3 old: libvpx1: ---------- new: 1.2.0-2 old: libxpm4: ---------- new: 1:3.5.10-1 old: libxslt1.1: ---------- new: 1.1.28-2 old:
  10. nginx: ---------- new: 1.4.1-3ubuntu1.3 old: nginx-common: ---------- new: 1.4.1-3ubuntu1.3 old:

    nginx-full: ---------- new: 1.4.1-3ubuntu1.3 old: ttf-dejavu-core: ---------- new: 2.33+svn2514-3ubuntu1 old: ! Summary ------------ Succeeded: 1 Failed: 0 ------------ Total: 1
  11. Add an SSH Key pete: user.present: - shell: /bin/bash -

    home: /home/pete - groups: - sudo ssh_auth.present: - user: pete - source: salt://pete.pub - require: - user: pete
  12. Pil•lar ˈpilər (noun) Variables for one or more minions 


    (ports, file paths, configuration parameters)
  13. base: '*': - default '*.lincolnloop.com': - lincoln_loop 'os:Ubuntu': - match:

    grain - pkgs.ubuntu /srv/pillar/top.sls Advanced Pillar Top File
  14. daemonize yes pidfile /var/run/redis.pid port 6379 bind 127.0.0.1 maxmemory {{

    maxmemory }} ... Using Pillars in Files /srv/salt/redis_server/redis.conf.jinja