How to install & configure Puppet server – part two

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

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

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

facter -p environment
production

Now lets configure hiera
How to use hiera
Create a yaml file in /etc/puppetlabs/puppet

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

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.

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.

puppet lookup --environmentpath /etc/puppetlabs/puppet sshservicename

To update the agent with new data just run

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

avatar
3000
  Subscribe  
Notify of