I achieve this by using the getvar function in stdlib. For example:
getvar("::network_${::gateway_dev}")
Regards,
Daniel
On Thursday, 31 March 2016 11:04:45 UTC+1, Jonathan Gazeley wrote:
>
> Hi folks,
>
> Short version:
>
> I want to use a variable inside a variable to access a fact. Is this
> possible?
>
> Long version:
>
> Facter provides facts $::ipaddress and $::netmask which figure out which
> is your primary interface and then return values like $::ipaddress_eth0
> and $::netmask_eth0. However there is not a $::network fact to reflect
> $::network_eth0.
>
> I have a custom fact $::gateway_dev which returns the name of the
> primary interface. Is it possible to access the variable like
> ${::network_${::gateway_dev}} ?
>
> Thanks,
> Jonathan
>
> --
> Jonathan Gazeley
> Senior Systems Administrator
> IT Services
> University of Bristol
>
--
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/44689bb5-7eff-4a03-ac80-095c5948eaaa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.