I am creating a Puppet configuration file for a service.
I would like to add the hostname as a variable in the line. However, it got an error because of nested quotation marks (") in the line.
$hostlocal = "${hostname}"
file {'puppet_facts_example':
ensure => file,
path => '/tmp/test.txt',
content => "modparam("topology_hiding", "th_callid_prefix", "$hostlocal_")"
}
If I just print $hostlocal, it shows the hostname correctly.
Is there any way to use a Puppet variable inside nested string quotes (")?
I also tried to use template. In the template,
modparam("topology_hiding", "th_callid_prefix", "<$= @hostlocal %>_")"
But the result was no value.
modparam("topology_hiding", "th_callid_prefix", "_")"
since hostname is a facter variable. it must be referenced as $hostlocal = $::hostname
Thanks vinodh
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With