Developing for this Puppet Tree - purplehazech/puppet-infra-project GitHub Wiki
Welcome to a quick overview how it is most efficient to develop for this puppet tree.
- local puppetmaster (use a linux virtual machine)
- a github clone of the project
Add the following to the start of /etc/puppet/puppet.conf
.
confdir = /usr/share/puppet-infra-project
Add this to your /etc/hosts
127.0.0.1 puppet
Checkout the infra repo.
cd /usr/share git clone [email protected]:/puppet-infra-project.git git checkout -b feature-branch cd puppet-infra-project git submodule init git submodule update
The repository has to be readable to the user puppet, but may be owned by your user for convenience.
Start puppetmaster.
/etc/init.d/puppetmaster start
Voila, you are ready to dive in.
Create /usr/share/puppet-infra-project/manifests/site.pp and make it contain the following content.
node default { $puppet_server = 'puppet' $zabbix_server_ip = '127.0.0.1' # map from facter to ldap $ipHostNumber = $ipaddress include infra }
Run the puppet agent:
puppet agent --test --noop --graph
The output contain both of these lines at some point.
Info: Applying configuration version ... Finished catalog run in (some) seconds
The --graph
part of the incantation should now have produced some dot files in /var/lib/puppet/state/graphs
. Properly rendered these might look as follows.
If you like what you see you can now go ahead and apply this config to your machine. This time leave out the --noop
(no operation) part of the command line.
puppet agent --test --graph
Puppet will now install a zabbix agent or reconfigure it if one was already installed through the operating systems package manager.
Next we add a simple sudo config to the default node. Please note that this is the kind of development you will later be doing in modules.
Add the following lines somewhere at the end of the node before }
include sudo sudo::conf { 'puppet-alias': content => 'Cmnd_Alias PUPPPET = /usr/bin/puppet agent --test --noop --graph, /usr/bin/puppet agent --test --graph'; } sudo::conf { 'puppet-user': content => 'puppetuser ALL = NOPASSWD: PUPPET'; }
If you execute this without --noop
the user puppetuser
can now run the commands we used so far on his own.
To be continued. Feedback welcome.