Need help for configuring / migrating from Puppet 3.8 to Puppet 6.x

47 views
Skip to first unread message

Matthias Steffens

unread,
Apr 17, 2019, 9:42:06 AM4/17/19
to Puppet Users
Hi everybody!

I've the task to migrate our existing puppet installation from Puppet 3.8 to Puppet 6.x and my colleague gave me the following tasks to do this:

- Hiera: all nodes should be configurable via hiera --> as with our currently installed version which has the following configuration:

---
:hierarchy:
 
- "nodes/%{::fqdn}"
 
- common
:backends:
 
- yaml
:yaml:
 
:datadir: "/etc/puppet/environments/%{::environment}/hieradata"

- integrate to hiera-levels: 1. One for "common" (valid for all nodes of the env) ---> have a look at the code above
                                     2. One per Client-Name

- NTP should be configured - the IP addresses of the NTP servers on the "common" should be taken over and overwritten by the "Node-Config" if necessary

- under /var/tmp/ the directory "common" should be created uniformly

- For each node, create a file under "/var/tmp/common" that has the hostname (FQDN) of the respective node. The content of the file should be the configured NTP-server.

Especially at the last point I have problems to implement this with puppet.

So far I've done the following:

- Created the site.pp under /etc/puppetlabs/code/environments/production/manifests with the following content:

Code hier eingeben...node default {
 
class { 'ntp':
    servers
=> [
     
'nist-time-server.eoni.com',
     
'nist1-lv.ustiming.org',
     
'ntp-nist.ldsbc.edu'
   
],
    service_enable
=> true,
    service_ensure
=> 'running',
 
}
  file
{ '/var/tmp/common':
   
ensure => 'directory'
 
}

}

- Create an hiera.yaml under /etc/puppetlabs/puppet with the following content:

---
# Hiera 5 Global configuration file

version
: 5

defaults
:
  datadir
: "/etc/puppet/environments/%{::environment}/hieradata"
  data_hash
: yaml_data
hierarchy
:
 
- name: "Common"
   path
: "common.yaml"
   data_hash
: yaml_data

 
- name: "Clients"
   path
: "nodes/%{::fqdn}"
# hierarchy: []

Hope, all of you can give me good tipps how I can solve my taks!

Thanks a lot for your help :)

Bob Vincent

unread,
Apr 17, 2019, 12:28:06 PM4/17/19
to puppet...@googlegroups.com
I believe the hierarchy should proceed from most-specific to most-general; therefore "common.yaml" should be the last, not the first, item in the list.

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/9e64de29-f7c9-4c51-996f-41aec7843911%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Robert August Vincent, II
(pronounced "Bob" or "Bob-Vee")
The web is like usenet, but
the elephants are untrained.

Martin Alfke

unread,
Apr 18, 2019, 2:31:16 AM4/18/19
to puppet...@googlegroups.com
Hi Matthias,
Please look into roles and profiles.

Usually a node has a business use case (the role).
A role is built upon several implementation profiles.
Within implementation profiles you will have parameters (which we use for hiera automatic lookup) and you will have resource declarations and provide information how a specific upstream module must be implemented to suit your infrastructure.

- Create an hiera.yaml under /etc/puppetlabs/puppet with the following content:

Starting with hiera v5 we have three levels where hiera data can be specified.
The third level (the last one where to look for data) is in a module.
You can identify a module using module specific hiera data by a hiera .yaml file in the module main directory.

The second level is the environment level. You can identify environment specific hiera by a hiera.yaml file located in the base of the environment.

The first (and deprectated level) is the global hiera level. You can identify global hiera data by a hiera.yaml file in the puppet config directory.
This is the one that you created.

Just move the file from puppet config directory to your environment.


---
# Hiera 5 Global configuration file

version
: 5

defaults
:
  datadir
: "/etc/puppet/environments/%{::environment}/hieradata"
  data_hash
: yaml_data
hierarchy
:
 
- name: "Common"
   path
: "common.yaml"
   data_hash
: yaml_data

 
- name: "Clients"
   path
: "nodes/%{::fqdn}"
# hierarchy: []


Hierarchies are built from specific to unspecific and use the complete filename (with ending).
When pacing the hiera.yaml file inside the environment you can specify a relative path
You have to revert the order:

---
# Hiera 5 Global configuration file
  #  /etc/puppetlabs/code/environment/production/hiera.yaml

version: 5

defaults:
  datadir: "hieradata"
  data_hash: yaml_data
hierarchy:
 - name: "Clients"
   path: "nodes/%{::fqdn}.yaml”
 - name: "Common"
   path: "common.yaml"

Hope, all of you can give me good tipps how I can solve my taks!

Thanks a lot for your help :)
hth,
Martin

Reply all
Reply to author
Forward
0 new messages