Hi Puppet Users,
Firstly I already know that I can override facter variables by adding them to the commandline. Eg:
root@dna:~# FACTER_fqdn=
foo.bar.info puppet apply --noop -e 'notice("${fqdn}")'
Notice: Compiled catalog for dna.local in environment production in 0.03 seconds
Notice: Finished catalog run in 0.04 seconds
I would like to use a number of different FACTER overrides, I can add them all to the command line but I want to test different values at different times. I was hoping that I could have a file like:
root@dna:~# cat test_values
FACTER_hostname=bob
FACTER_domain=mgnt.local
FACTER_fqdn=bob.mgnt.local
FACTER_foo=foo
Then like with the hiera command line tool use an option to tell puppet apply to use this file and override any facts with the same name. However there isnt an option.
I have found a bash command which will take the values from the file and concat them together to form one line:
root@dna:~# cat test_values | tr '\n' ' '
FACTER_hostname=bob FACTER_domain=mgnt.local FACTER_fqdn=bob.mgnt.local FACTER_foo=foo
I was then hoping I could do something like:
root@dna:~# $(cat test_values | tr '\n' ' ' ) puppet apply --noop -e 'notice("${fqdn}")'
-bash: FACTER_hostname=bob: command not found
However it doesn't work.
My question is, does anyone know a puppet way pass a file to puppet apply which will override facts or if there are any bash experts out there how I can have the output of the command as plan text.
Thanks,
Peter