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

Saltstack

 Saltstack

The slides of a lecture/presentation on 2017-03-12 @ Chemnitzer Linux Tage

Avatar for Christian Prior

Christian Prior

March 12, 2017

Other Decks in Programming

Transcript

  1. EVENTBUS 0mq implementation almost invisible but powerful accesible via REST

    API #a first example how to use salt in the command line sudo salt-run state.event pretty=True
  2. USECASE DATA MASSAGING https://github.com/helotism/helotism Installer script for a 250€-cluster solving

    basic sysadmin requirements Computation Network Powersupply Interaction Storage Synchronization Fixture router DHCP DNS GPIO RTC timesync rack configuration management
  3. ECOSYSTEM Saltstack Ecosystem master - states - pillar - environments

    - reactor - syndic, multi-master minion minion proxy minion SSH minion cloud minion - grains - beacon pillar states master minions www.helotism.de
  4. INSTALLATION 1/2 Platform Guides Dependencies PyYAML, ZeroMQ and a few

    more //PyGit is problematic: ArchLinux does it out of the box. (Later more.)
  5. BOOTSTRAP 2/2 docs repo options curl -o bootstrap_salt.sh -L https://bootstrap.saltstack.com

    --silent -k; sleep $_SUDO sh -s -- -U -P -M -L -A mysaltmasterid -i myminionid git v2016. 11.3
  6. DEPENDENCIES Standard dependencies handled well with distros My personal killer

    feature 'source control integration' typically requires self-compiling libgit2. pygit2 installation libgit2 installation good hint python -c 'import pygit2' must work to use e.g. GitHub repos as " leserver"
  7. DEFAULT CONFIGURATION con guration: /etc/salt/ -> master & master.d, minion

    & minion.d broadcasted data: /srv/salt con dential data: /srv/pillar packages: formulas docu repo
  8. MAJOR FUNCTIONAL COMPONENTS message queue, remote execution, state* runs, hard-

    and software inventory, target orchestration AUXILIARY FUNCTIONAL COMPONENTS *, to spin up cloud instances, proxy-control non-python-devices, salt via ssh event reactors
  9. SALTSTACK STATE FILE #apache.sls {% if grains['os'] == 'Debian' %}

    apache: apache2 {% elif grains['os'] == 'RedHat' %} apache: httpd {% endif %} Jinja2 template language one should read the ne manual: http://jinja.pocoo.org/docs/dev/
  10. BEACONS ON THE MINIONS beacons: inotify: /opt/helotism/show-cfgmgt_venv/performance.yml: mask: - modify

    disable_during_state_run: True REACTORS ON THE MASTER reactor: - salt/beacon/*/inotify/opt/helotism/show-cfgmgt_venv/config.yml: - /srv/reactor/show-cfgmgt.sls
  11. ENVIRONMENTS master minion minion(s) ssh cloud provider proxy minion Jinja2

    grains beacon syndic states pillar environments
  12. CONFIGURATION GITFS gitfs_remotes: - [email protected]:cprior_/cpr.git: - name: cpr - root:

    application/physical/saltstack/assets/srv/salt - base: master - pubkey: /etc/pki/id_saltmaster.pub - privkey: /etc/pki/id_saltmaster - https://github.com/cprior/saltstack-not-yet-formulas.git: - name: saltstack-not-yet-formulas - root: application/physical/saltstack/srv/salt - base: master
  13. REMOTE EXECUTION sudo salt 'saltmaster' pkg.install emacs sudo salt 'saltmaster'

    pkg.version emacs sudo salt 'saltmaster' pkg.purge emacs && sudo apt-get autoremove
  14. GENERIC STATE FILE YAML <ID Declaration>: <State Module>: - <Function>

    - <Function Arg> - <Function Arg> - <Function Arg> - <Name>: <name> - <Requisite Declaration>: - <Requisite Reference> - <Requisite Reference>
  15. FORMULAS pre-written Salt States clone and change le_roots adjust pillar.example

    into own /srv/pillar le Example: My user con guration
  16. JINJA2 Python template engine state les are by default parsed

    as Jinja templates control structures whitespace control
  17. WINDOWS MINION Really easy to install! Windows repository sudo salt

    'mywinnb' pkg.install blender salt-winrepo-ng