About | FAQ | Help
Ask Your Question

Passing Consul Token as Fact Into Hiera

asked 2017-08-02 12:15:16 -0500

eric aldinger gravatar image

updated 2017-08-02 16:10:33 -0500

I am converting one of my masterless modules to use Consul. How do I use external facts to pass in the Consul host and Consul token? These change in every environment and are not managed by Puppet. I am using mod 'lynxman-hiera_consul', '0.1.2'

Before my masterless run I export some facts

export FACTER_CONSULHOST=consul-randomid..us...

export FACTER_MYTOKEN=some-token

I can test this works with

facter mytoken; puppet facts --debug|grep mytoken

facter consulhost;puppet facts --debug|grep consulhost

My hiera.yaml looks like this Hiera.yaml Gist. Works fine if I replace the fact interpolation with strings.

With the basic issue being with the fact interpolation on line 15

:token: "%{facts.mytoken}"

This is my example manifest for testing this Consul.pp Gist

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-08-03 17:55:26 -0500

eric aldinger gravatar image

Answers seem to be coming in on SO https://stackoverflow.com/questions/4...

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


Asked: 2017-08-02 12:07:03 -0500

Seen: 54 times

Last updated: Aug 03 '17