Skip to content

azcender/puppet-r10k

Repository files navigation

puppet-r10k

Vagrant environment for PE3 (currently 3.3.2) w/ r10k development and current best practices for building out self-contained environments (classification, code & data bindings).

Setup leverages work done in the zack/r10k Forge module. It includes an MCollective plug-in to allow r10k operations via Live Management in the Enterprise Console.

The r10k environments are self-contained. Directories include:

  • hierdata directory
  • modules directory built out via Puppetfile
  • manifests/site.pp for node classification

Note: this self-contained environment structure is the Forest Service's Continuous Delivery repository.

References & Supporting Materials

Supporting materials:

Requirements

  • rvm >= 1.25.31
  • VirtualBox == 4.3.20
  • Vagrant == 1.6.5
  • vagrant-oscar ( '$ vagrant plugin install oscar' )
  • vagrant-vbguest ( '$ vagrant plugin install vagrant-vbguest' )
  • librarian-puppet gem ( '$ gem install librarian-puppet' )
  • nokogiri gem ( $ gem install --install-dir ~/.vagrant.d/gems nokogiri -v '1.6.4.1' )
  • vagrant-centos7_fix ( $ vagrant plugin install vagrant-centos7_fix )
  • puppet gem ( $ gem install puppet )

Upgrades

This environment uses vagrant oscar plugin. Whenever oscar is updated, engineers will need to wipe out old VMs and settings before doing a 'vagrant up' with the new release:

$ cd <repo>
$ vagrant destroy -f
$ rm -rf .vagrant
$ (cd puppet && rm -rf modules)
$ git pull

Usage

(perhaps after Upgrade directions above)

$ cd <repo>
$ (cd puppet && librarian-puppet install --verbose)
$ vagrant up

Notes

  • vagrant environment will download the required baseboxes if they've not already been installed. This can result in quite a long first run.
  • Login to console via: https://localhost:8443 w/ credentials: [email protected]/puppetlabs
  • r10k builds out environments in master:/etc/puppetlabs/puppet/environments based on the branches puppet-r10k-environments repo. You can point r10k to a different repo by modifying the Hiera key in puppet/hierdata/common.yaml.

Supplemental PE downloads

Version OS Link
3.3.2 Ubuntu Download
3.3.2 RHEL/CentOS Download
3.3.2 Windows Download

Installation steps

UBUNTU - RARING/SAUCY

$ sudo apt-get install git
$ sudo apt-get install curl
$ sudo apt-get install vagrant

Check "Run command as login" checkbox in terminal profile. Exit and relaunch terminal application.

OS X

Install git 1.8.5.2 for OS X with defaults (admin required).

Install Xcode (and command-line tools) for your version of OS X (admin required). Run it once. xcode-select --install

Install VirtualBox 4.3.20 for OS X with defaults (admin required).

Install Vagrant 1.6.5 for OS X with defaults (admin required).

Install homebrew (if you don't already have ports installed)

$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"

If you're using ports:

$ sudo port install libxml2 libxslt # (only if using ports)

If you're using homebrew

$ brew install libxml2 libxslt # (only if using homebrew)
$ brew link libxml2 libxslt # (only if using homebrew)

WINDOWS

Install git 1.9.4 for Windows with defaults. (admin required)

Install ruby 2.2.0-p481 for 64-bit Windows - Tcl/Tk support, add to path, associate. (admin required)

Extract Ruby DevKit DevKit-mingw64-64-4.7.2-20130224-1432-sfx to C:\Ruby200-x64\DevKit (admin required as well as 7-Zip utility)

Launch git bash

$ cd /c/Ruby200-x64/devkit

$ ruby dk.rb init

add '- C:/Ruby200-x64' to bottom of config.yml

$ ruby dk.rb install

$ gem update # ('y' to update rake|rdoc|ri)

Install VirtualBox 4.3.20 for Windows with defaults (admin required).

Install Vagrant 1.6.5 for Windows with defaults (admin required).

COMMON - Skip rvm steps on Windows, start "continue" below

Install RVM:

$ \curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enabled

$ rvm get head

$ rvm install 2.1.2

$ rvm reload

$ rvm --default use 2.1.2

Continue:

$ vagrant plugin install oscar

$ vagrant plugin install vagrant-vbguest

$ gem install librarian-puppet

$ gem install puppet

$ cd ~/sandbox

$ git clone [email protected]:prolixalias/puppet-r10k.git

$ cd puppet-r10k/puppet

$ librarian-puppet install --clean --verbose

$ vagrant plugin update

$ vagrant up  # NOTE: be sure to launch Git bash as administrator on Windows for adding vbox network interface(s) and dealing with Windows firewall

Troubleshooting

  • vagrant-hosts sometimes fails to insert the master's hostname into the /etc/hosts files on the agent VMs. One work-around is to run:

    $ vagrant provision --provision-with hosts

  • For diagnosing vagrant issues, the following command will be utterly useful:

    $ VAGRANT_LOG=DEBUG vagrant up 2>&1 | tee /tmp/puppet-r10k-vagrant.runlog