Testing puppet stuff using Vagrant VMs
Pull request Compare This branch is 22 commits behind gnubila-france:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
dist/site/files/puppet
hieradata
manifests
shell
.gitignore
.ruby-gemset
.ruby-version
Gemfile
Gemfile.lock
LICENSE
Puppetfile
README.md
Rakefile
Vagrantfile

README.md

puppet-vagrant-playground

Testing puppet stuff using Vagrant VMs.

Two Debian Wheezy VirtualBox VMs can be created: master and client.

  • Master is a basic puppetmaster running with webrick.
  • Client is a puppet agent configured using hiera and a default node definition (ie. a nodeless setup).

Provisionning is done in two steps:

  • A shell script shell/base.sh will update the VM and install puppet
  • Provisionning using puppet
    • Puppet apply will be used to provision the puppetmaster
    • Puppet agent will provision the client, using previously configured master

The local puppet modules are stored into the dist directory. The remote puppet modules are installed locally in the modules directory on the host using r10k.

The manifests, modules, dist and hieradata directories are synchronized with the puppetmaster in /etc/puppet.

Prerequisities

  • vagrant
  • bundler

Installing required gems

The gems from the Gemfile will be installed.

A rvm profile configuration is provided.

bundle install

Installing vagrant plugins

vagrant plugin install vagrant-cachier
vagrant plugin install vagrant-hostsupdater
vagrant plugin install vagrant-vbguest

A rake task is also provided:

rake vagrant_plugins

Downloading modules using r10k

The modules that will be installed to the modules directory are listed into the Puppetfile.

r10k -v INFO puppetfile install

A rake task is also provided:

rake r10k

Bootstraping the puppetmaster

vagrant up master
vagrant ssh master

Bootstraping the client

vagrant up client
vagrant ssh client

Signing the puppet certificate of the client

vagrant ssh master
sudo puppet cert sign client.local.lan

Manually launching the puppet agent

sudo puppet agent -vt

Knwon bugs

Workaround for VirtualBox 4.3.10 Guest Additions

Required at each VM recreation.

  • Edit the Vagrantfile to set the owner and group for the synced_folder to root. (Only for the master, as folder sync failed, puppet was not installed hence the puppet user does not exist yet)

  • Fix the VBox additions and reload the VM:

vagrant ssh master -c 'sudo ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions'
vagrant reload master

Once puppet is installed on the master, revert the owner and group of the synchronized directories and relaunch a pass to fix possible errors due to incorrect rights for the directories.

  • Edit the Vagrantfile to set the owner and group for the synced_folder to puppet
  • Reload the VM and force provisionning
vagrant reload --provision master

Links