This is the second post on how to configure the Puppet server/client on Solaris.
The Solaris Puppet configuration is mostly the same as the regular Puppet, but with a few exceptions.
First lets add a new facts to facter
1 2 3 4 5 6 |
cat /usr/puppetlabs/puppet/modules/stdlib/lib/facter/env.rb Facter.add('environment') do setcode do environment = "production" end end |
Now lets verify the new fact
1 2 |
facter -p environment production |
Now lets configure hiera
How to use hiera
Create a yaml file in /etc/puppetlabs/puppet
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
cat /etc/puppetlabs/puppet/hiera.yaml --- :backends: - yaml - json :hierarchy: - "%{osfamily}" - common :yaml: :datadir: /etc/puppetlabs/code/environments/%{environment}/hieradata/ :json: :datadir: /etc/puppetlabs/code/environments/%{environment}/hieradata/ |
Next configure/add a fact to hiera
1 2 3 4 5 6 7 |
cat /etc/puppetlabs/code/environments/production/hieradata/Solaris.yaml --- sshservicename: ssh cat /etc/puppetlabs/code/environments/production/hieradata/RedHat.yaml --- sshservicename: sshd |
Now lets verify if it works, the below should return ssh or sshd based on OS.
1 2 3 4 5 6 |
hiera -d -c hiera.yaml sshservicename environment=production osfamily=Solaris DEBUG: 2017-02-20 14:55:35 -0500: Hiera YAML backend starting DEBUG: 2017-02-20 14:55:35 -0500: Looking up sshservicename in YAML backend DEBUG: 2017-02-20 14:55:35 -0500: Looking for data source Solaris DEBUG: 2017-02-20 14:55:35 -0500: Found sshservicename in Solaris ssh |
Anther way to test hiera lookups.
1 |
puppet lookup --environmentpath /etc/puppetlabs/puppet sshservicename |
To update the agent with new data just run
1 |
puppet agent --test |
If you like to know how to install puppet (server or client) on Solaris, please read part one.
Puppet Hiera beginners help
Leave a Reply