Ask Your Question
0

What do I replace legacy facts with in the hiera.yaml file?

asked 2016-12-07 05:39:44 -0500

schowdhury gravatar image

According to the following documentation, we have a lot of legacy facts:

https://docs.puppet.com/facter/latest...

There's a legacy fact that I have specified quite a lot in my hiera.yaml, which is the 'fqdn':

https://docs.puppet.com/facter/latest...

From what I can see, I should now be using 'networking.fqdn':

https://docs.puppet.com/facter/latest...

So in my case I tried to change my hiera.yaml from:

$ cat /etc/puppetlabs/code/hiera.yaml
---
:backends:
  - yaml
:yaml:
  :datadir: '/etc/puppetlabs/code/environments/hieradata'
:hierarchy:
  - /%{fqdn}"

To:

$ cat /etc/puppetlabs/code/hiera.yaml
---
:backends:
  - yaml
:yaml:
  :datadir: '/etc/puppetlabs/code/environments/hieradata'
:hierarchy:
  - /%{::networking.fqdn}"

Does this look correct?

edit retag flag offensive close merge delete

Comments

No, it's `$::facts['networking']['fqdn']`. You have to ensure all the clients have a current facter version, bc modern facts came with facter v3. Otherwise your PP run horribly fails (unless you catch it).

Kai Burghardt gravatar imageKai Burghardt ( 2016-12-07 06:02:48 -0500 )edit

I'm using puppet 2016, and have all the modern facts showing up. However I thought the`$::facts['networking']['fqdn']` notation is how you refer to facts inside manifests, not hiera.yaml. Are you saying the same notation works for both now?

schowdhury gravatar imageschowdhury ( 2016-12-07 09:13:46 -0500 )edit

Yeah, no. I've never used hiera. Just run `facter` (as root on your destination client) and inspect how the structure looks like. The notable point is, that there's a `facts` variable of the (ruby) type `hash`.

Kai Burghardt gravatar imageKai Burghardt ( 2016-12-07 09:37:52 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-12-07 14:28:53 -0500

lupin gravatar image

updated 2016-12-07 14:35:51 -0500

:hierarchy:

- "/%{::networking.fqdn}"

Take note of the ".

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-12-07 05:39:44 -0500

Seen: 68 times

Last updated: Dec 07 '16