try add "export" before Facter_hostname=bob
On Saturday, May 3, 2014 7:41:17 PM UTC+8, Peter wrote:
>
> 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: Scope(Class[main]): foo.bar.info
> 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
>
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/70f7d36e-4778-479c-8d3d-46b1eb0a166a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.