Puppet

Justin Bronn jbronn on GitHub

Configuration Management

  • Why do we need it? Complexity.
  • Even a "simple" web app has a large number of components

Why Puppet and not another one

  • SaltStack: homegrown crypt.py
  • Ansible: GPLv3

Basic

  • Resources
  • Declarative
  • Facts with Facter
    • Access in your code at $::whatever

Resource Ordering

  • Other resources are referenced with the type capitalized and the name quoted as a key --> Package['openssh-server']
  • Subscribe metaparameter
  • Notify metaparameter
  • Chaining arrows: Package['ssh'] -> File['/etc/ssh/sshd_config']

  • Modules

  • containers for puppet code
  • analogous to python modules
  • puppet forge: https://forge.puppetlabs.com
    • lookup django-forge on github if you want to run your own puppet forge
  • $ puppet module install [module-name]
  • Modulefile describes the module
  • entry point is manifests/init.pp
  • templates files go in templates/
  • static files go in files/

Writing modules for python apps

    class pyapp {
        include python
        include python::virtualenv
        include redis
        include nginx
    }
  • pipx provider
  • venv type to create virtualenvs
  • venv_package type

Tracking: puppet board

Module development

  • Use Vagrant!
  • Packer; see his example at github:jbronn/packer-vagrant.git