Hi Matthias, > On 17. Apr 2019, at 15:42, Matthias Steffens <matthiasmueh...@gmail.com> > wrote: > > 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' > } > > } >
Please look into roles and profiles. https://puppet.com/docs/pe/2019.0/designing_system_configs_roles_and_profiles.html <https://puppet.com/docs/pe/2019.0/designing_system_configs_roles_and_profiles.html> 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 -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/F53AA13F-9C58-4A02-8E1C-504E91C21CD6%40gmail.com. For more options, visit https://groups.google.com/d/optout.