43 cards
View
Linked contentRepeats
Claus-Theodor Riegg
3 years
Repeats
Claus-Theodor Riegg
1 year
Andreas Herz
1 year
Linked content
Claus-Theodor Riegg
2 years
Claus-Theodor Riegg
2 years
Claus-Theodor Riegg
2 years
Claus-Theodor Riegg
3 years
Linked content
Marius Schuller
3 years
Claus-Theodor Riegg
3 years
Claus-Theodor Riegg
3 years
Linked content
Claus-Theodor Riegg
3 years
Claus-Theodor Riegg
3 years
Posted over 3 years ago. Visible to the public.

puppet variable variable name

example

We want to make the following firewall rule to be applyable to different network interfaces (for e.g. different environments) with just one variable:

Copy
firewall { "010-reject-port": ensure => present, dport => [ 80 ], destination => $::ipaddress_eth0, proto => 'tcp', action => 'drop', iniface => 'eth0', }

We can create a $firewall_interface variable and apply it to iniface but how can we ensure that the correct ipaddress factof the corresponding interface is used for destination?

Solution:

Use getvar from the puppetlabs stdlib:

Copy
$firewall_interface = 'eth0' firewall { "010-reject-port": ensure => present, dport => [ 80 ], destination => getvar("::ipaddress_${firewall_interface}"), proto => 'tcp', action => 'drop', iniface => $firewall_interface, }

Owner of this card:

Avatar
Claus-Theodor Riegg
Last edit:
over 3 years ago
by Andreas Herz
Keywords:
ops
This website uses cookies to improve usability and analyze traffic.
Accept or learn more