Puppet Test A Module

Puppet open source

Very simple environment , no puppet master, no configurations sites or nodes only code.

create a fresh machine with vagrant

I used ubuntu 12.04

mkdir testpuppet
vagrant init precise64 http://files.vagrantup.com/precise64.box
vagrant up
vagrant ssh

install puppet open source

vagrant@precise64:~$ sudo -i
wget http://apt.puppetlabs.com/puppetlabs-release-precise.deb 
dpkg -i puppetlabs-release-precise.deb 
apt-get update
apt-get install puppet

load a simple example in the modules directory

cd /etc/puppet/modules/
mkdir testdup
cd testdup
mkdir manifests
mkdir test
nano manifests/init.pp

put a simple code to verify if the proof of concepts work

class testdup {
  notify { "Hello ${fqdn}": }
}

edit the test file

echo "include testdup" >> test/init.pp

verify if works

root@precise64:/etc/puppet/modules/testdup# puppet apply test/init.pp 
Notice: Compiled catalog for precise64 in environment production in 0.02 seconds
Notice: Hello precise64
Notice: /Stage[main]/Testdup/Notify[Hello precise64]/message: defined 'message' as 'Hello precise64'
Notice: Finished catalog run in 0.01 seconds

if you want to use a different module directory or you are using puppet enterprise add to puppet.conf the row

basemodulepath=/etc/puppetlabs/puppet/modules

an example done for windows

PS C:\Users\Administrator\temp\testdup> puppet apply --basemodulepath=.. test/init.pp

in the directory C:\Users\Administrator\temp I have copied also some other modules necessary to fully run the test
Salvo diversa indicazione, il contenuto di questa pagina è sotto licenza Creative Commons Attribution-ShareAlike 3.0 License