William Myers
10/04/2022, 11:10 PMWilliam Myers
10/04/2022, 11:10 PMnatemccurdy
10/04/2022, 11:10 PMWilliam Myers
10/04/2022, 11:11 PMWilliam Myers
10/04/2022, 11:11 PMWilliam Myers
10/04/2022, 11:11 PMWilliam Myers
10/04/2022, 11:11 PMnatemccurdy
10/04/2022, 11:11 PMnatemccurdy
10/04/2022, 11:13 PMdefault
node definition based on the value of a fact.William Myers
10/04/2022, 11:13 PMnatemccurdy
10/04/2022, 11:15 PMrole
that you make and add to all of your nodes.
This role
fact just acts a label that you can use in conditional logic to include other classes and modules.
(that’s one part of the “roles and profiles” pattern)natemccurdy
10/04/2022, 11:16 PMnode default {}
definition, and looks at the trusted fact called pp_role
(but for example’s sake, imagine that’s just role
), and includes a class named after the fact’s value.natemccurdy
10/04/2022, 11:21 PMnatemccurdy
10/04/2022, 11:22 PMWilliam Myers
10/04/2022, 11:22 PMIan CB
10/05/2022, 8:03 AMMartin Minkus
10/05/2022, 12:03 PMhbui
10/05/2022, 1:23 PMpuppet lookup <key> --node <nodename> --environment <environment> --explain
to see the path that puppet consults including the hiera.yaml files consulted. Typically it consults the hiera.yaml on the system (which is also typically empty) and then moves on to the hiera.yaml in the controlrepo.
If the hierarchy you defined has fact names in the path to the file, then puppet will load that fact name and construct the path and then look in that yaml file for any key you lookup
e.g.
---
version: 5
defaults:
# location of the hiera yaml data directory, relative to this file
datadir: data
data_hash: yaml_data
hierarchy:
- name: "Global override"
path: "global.yaml"
- name: "Per-node data (yaml version)"
path: "nodes/%{::clientcert}.yaml"
- name: "Per operatingsystem"
path: "os/%{::operatingsystem}.yaml"
- name: "common"
path: "common.yaml"
this is an old sample hiera.yaml and puppet will consult global.yaml first and then consult the next layers. The second and third layers will be specific to the node that is checking in. The first and fourth will be the same regardless the node. Does that answer your question?Dr Bunsen Honeydew
10/05/2022, 1:23 PMSlackbot
10/05/2022, 1:32 PMSlackbot
10/05/2022, 1:35 PMhbui
10/05/2022, 1:35 PMSlackbot
10/05/2022, 1:36 PMJohn Ratliff
10/05/2022, 1:37 PMsudo /opt/puppetlabs/bin/puppet agent --test --agent_disabled_lockfile=/nonexisting --noop 2>&1 | tee /home/jdratlif/puppet.log
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Function lookup() did not find a value for the name 'classes' on node REDACTED
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
sameer
10/05/2022, 2:09 PMsameer
10/05/2022, 2:31 PMSlackbot
10/05/2022, 4:55 PMLumiere
10/05/2022, 4:56 PMWilliam Myers
10/05/2022, 5:31 PMnatemccurdy
10/05/2022, 5:33 PMinit.pp
is fine for something that small.