Puppet

Puppet

Puppet programs are called ‘manifests’, and they use the .pp file extension.

The place to find and share modules for Puppet: http://forge.puppetlabs.com/ :: Home | Puppet Module Repository | Puppet Labs

The Facter is a lightweight library for retrieving simple operating system facts, like operating system, linux distribution, or MAC address. It’s standalone utility (bundled in Vagrant with Puppet) that can be invoked by typing facter.


Vagrant Virtualised Dev Environments

Recipes: https://gist.github.com/2003430 :: Puppet class recipe to install Node.JS & ZeroMQ on Ubuntu 10.04 LTS / Lucid — Gist garthk/puppet-chrislea

http://forge.puppetlabs.com/puppetlabs/nodejs :: Module: puppetlabs/nodejs | Puppet Module Repository | Puppet Labs

Run Stages

Puppet dependencies and run stages | John Leach’s Blog puppet tricks: staging puppet « nytefyre/net3.0

Puppet modules / manifests repository: http://forge.puppetlabs.com/ :: Home | Puppet Module Repository | Puppet Labs

Minimalistic Practical Introduction to Puppet (Not Only) For Vagrant Users « The Holy Java

Part 3: Bootstrapping Your Environment with Vagrant and Puppet « Devops.me

http://vstone.eu/vagrant-quickstart-for-puppet-devops/ :: Vagrant quickstart for Puppet dev(op)s | vStone Blog

https://github.com/mattmcmanus

Great example of Development Environment:

Learning:

# /root/learning-manifests/break_ssh.pp
package { 'openssh-server':
  ensure => present,
  before => File['/etc/ssh/sshd_config'],
}

file { '/etc/ssh/sshd_config':
  ensure => file,
  mode   => 600,
  source => '/root/learning-manifests/sshd_config',
}

service { 'sshd':
  ensure     => running,
  enable     => true,
  hasrestart => true,
  hasstatus  => true,
  subscribe  => File['/etc/ssh/sshd_config'],
}

Symlinking /var/www to /vagrant does what you wanted without having to dive into httpd.conf:

file { ‘/var/www’: ensure => link, target => ‘/vagrant’, force => true, require => Package[‘apache2’] }

Learning

Good example of using command/unless Puppet pattern: Magento-Vagrant-Puppet.

Why .erb files? Ruby Template Files - Because they can contain variables. ERB is part of the Ruby standard library. You do not need to install any other software to use it. An Introduction to ERB Templating Using Puppet Templates — Documentation — Puppet Labs

Variables in JSON files: pperezrubio/puppet-vagrant-template JSON Parser is in stdlib module.

I don’t understand why this Vagrant plug-in(vagrant-puppetconf) is made. I allows you to update some puppet variables directy from Vagrantfile. I think that this can be achieved without extra module - with Facter, as shown in this example. It’s documented here.

Learning Sources

Puppet Tutorial for Linux: Powering up with Puppet

Collection of task oriented solutions in Puppet: Puppet CookBook

Style Guide and linting rodjek/puppet-lint

Setting up a LAMP box with Puppet

Puppet with out barriers -part one « soimasysadmin Puppet with out barriers -part two « soimasysadmin Puppet with out barriers -part three « soimasysadmin

Simple commands

Print the current configuration.

puppet config print all

Modules

My idol. Almost everything I need: khoomeister/puppet-devbox

The main idea and logic was taken from: dirkaholic/vagrant-php-dev-box benlumley/VagrantPuppet · GitHub

I could need a following modules.

Used

Nullmailer: mattmcmanus/puppet-nullmailer · GitHub

MySQL: mattmcmanus/puppet-mysql example42/puppet-mysql

PHP: example42/puppet-php · GitHub Vagrant-Puppet/puppet/modules/php at master · charlesvardeman/Vagrant-Puppet · GitHub PHP PEAR: rafaelfelix/puppet-pear · GitHub

PHP Composer: exec { ‘install_composer’: command => ‘curl -s https://getcomposer.org/installer | php – –install-dir="/bin"’, require => [ Package[‘curl’], Class[“php::install”, “php::config”] ], unless => ‘which composer.phar’, }

Apache: example42/puppet-apache

Lighttpd

Automating lighttpd installations with Puppet – Part 1 | pureVirtual Accompanying module: virtualswede/virtualswede-lighttpd · GitHub Installing Lighttpd With PHP5 (PHP-FPM) And MySQL Support On Ubuntu 12.04 | HowtoForge - Linux Howtos and Tutorials

Simplest module as an example: duritong/puppet-lighttpd puppet-modules/lighttpd at master · example42/puppet-modules · GitHub

Redis: example42/puppet-redis

More LAMP modules: theferrer/vagrant-lamp · GitHub example42/puppet-modules-nextgen jas0nkim/my-vagrant-puppet-lamp · GitHub micrub/puppet-lamp · GitHub awaseroot/puppet at master · awaseroot/awaseroot · GitHub

Zookeeper Puppet Modules puppet/modules/adobe-zookeeper by Adobe exit4b/puppet · GitHub

My devbox

  • site.pp: first file that the Puppet parses
  • templates.pp: defines all template classes
  • nodes.pp: defines all the nodes. All nodes must have a name equal to their hostname. If you create a node named default, the node configuration for default will be used if no other node matches are found. nodes

I’m using so called ’nodeless’ puppet: Puppet “pure fact-driven” nodeless configuration puppet-examples/nodeless-puppet

Directory Structure Patterns

File Hierarchy: Puppet Best Practice2 Module Layout: Module Fundamentals

puppet-modules-structure.png [gutocarvalho] Clean Puppet code Simple Puppet Module Structure | R.I.Pienaar How to organize puppet manifests (directory structure)

Advanced Puppet Pattern - Puppet - Puppet Labs Stop Writing Puppet Modules That Suck How to create a VM with PHP 5.4 using Vagrant and Puppet | Ricbra’s Blog

module_cheat_sheet.pdf (application/pdf Object)

Problems & solutions

Message: No LSB modules are available

This message is issued by Facter. It simply states that there are no LSB facts available. It’s simple to fix - not really a fix, because it’s intentionally missing from the base install. Anyway, there is an easy way to enable LSB facts via Puppet)

Vagrant Startup Warning: No LSB modules are available.

There is no way to fix this ’noise’. The message is from lsb_release command in terminal.

Testing the Puppet

When in VM (don’t forget sudo):

puppet apply --noop --modulepath=../modules/ site.pp
puppet apply --noop --debug --verbose --modulepath=../modules/ site.pp

--Noop switch is here to forbid any real operation on system.

In Vagrant, this is the executed line:

cd /tmp/vagrant-puppet/manifests &&
FACTER__ip_main='192.168.7.70' FACTER__ip_node='192.168.7.71'
puppet apply --modulepath '/tmp/vagrant-puppet/modules-0' /tmp/vagrant-puppet/manifests/site.pp

Set

saz/puppet-resolv_conf saz/puppet-dnsmasq · GitHub

Very interesting: camptocamp/puppet-rdiff-backup

Great source of modules: git.puppet.immerda.ch Git

Anchors

styleguides/puppet.md at master · alphagov/styleguides Anchor Pattern - Puppet - Puppet Labs

Documenting Puppet files

Style Guide — Documentation — Puppet Labs

Fuck Ruby DSL

FreeSoft - Puppet: Ruby is not Ruby (part 1) - Dragula - Simple Project Management Puppet: Sometimes =, sometimes =>

More stupid problems: Question about conditional exec notifications - Google Groups

date 01. Jan 0001 | modified 29. Dec 2023
filename: Puppet - The Basics