Ask Your Question
0

puppet hiera lookup

asked 2016-09-29 02:52:34 -0500

shimm gravatar image

Hi,

i've jsut added a new client to my puppet 4.6 master. The Client retrieves the catalog and also connection is all fine.

In the mail manifest i'll try to use a variable

$test = hiera('testvar')
notify {"VAR = $test": }

the var is stored in hieradata/net/192.168.1.0.yaml (which works fine for other nets...)

---
testvar: 'foobar'

my /etc/hiera.yaml hierachy looks like:

:hierarchy:
  - "node/%{::clientcert}"
  - "lsbdist/%{::lsbdistcodename}"
  - "net/%{::network_eth0}"
  - "common"

now if I do a lookup on the master, I see:

$> puppet lookup --node testnode.domain.com --debug testvar
[...]
Debug: hiera(): Found testvar in net/192.168.1.0
--- 'foobar'

But the puppet run on the client shows:

Notice: /Stage[main].../Notify[VAR = ]/message: defined 'message' as 'VAR = '

I'm out of Ideas what can cause this problem, since it's working fine with the same manifest, the same variable for other networks.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-09-29 12:40:28 -0500

lupin gravatar image

updated 2016-09-29 12:41:18 -0500

Compare the output of facter -p network_eth0 fact on both working and non-working clients. The value of network_eth0 must resolve to 192.168.1.0 in your post.

edit flag offensive delete link more

Comments

I would also do a test like the following to see how puppet sees the fact .. puppet apply -e 'notice($::network_eth0)'

DarylW gravatar imageDarylW ( 2016-09-29 14:19:26 -0500 )edit

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-09-29 02:52:34 -0500

Seen: 46 times

Last updated: Sep 29 '16