How to use Puppet module in Foreman

You have installed Foreman... So, what's happen next ? How to use it ?

Let's take an example. You wan't to automagically add vmware tools repo to all your VM. First step is to select a good APT module, like this one.

The current mmattice APT documentation shows you all the options and syntax you would use in puppet (and we want to use foreman in front of it).

From the documentation :

apt::source { 'puppetlabs':
  location   => 'http://apt.puppetlabs.com',
  repos      => 'main dependencies',
  release    => 'precise',
  key        => '66FD4949',
  key_server => 'pgp.mit.edu',
}

The yaml version you would put in foreman :

puppet-labs:
 location:http://apt.puppetlabs.com
 release: precise
 repos: main dependencies
 key: 66FD4949
 key_server: pgp.mit.edu

Let's go back with our example, first open Puppet APT Class definition. Click on APT (the one with 13 parameters) :

Puppet class

Then, open the 'sources' classe.

1/ check the 'Override' parameter,

2/ choose the yaml parameter type

3/and enter the repo definition in the 'Default value' text box.

Puppet smart class

Click 'Submit' and then apply APT classe to your host or host group. For an immediate testing run sudo puppet agent --test on a node.

The result will be like :

fred@web2:/etc/apt/sources.list.d$ cat vmware-tools.list
# This file is managed by Puppet. DO NOT EDIT.
# This is the VMware tools official repo
deb http://packages.vmware.com/tools/esx/latest/ubuntu precise main

Et voilĂ  !