Defined Type: interface::post_up_command
- Defined in:
- modules/interface/manifests/post_up_command.pp
Overview
SPDX-License-Identifier: Apache-2.0
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'modules/interface/manifests/post_up_command.pp', line 2
define interface::post_up_command(
String[1] $interface,
String[1] $command,
Wmflib::Ensure $ensure = 'present',
) {
if $ensure == 'absent' {
file_line { "rm_${interface}_${title}":
ensure => absent,
path => '/etc/network/interfaces',
match => "post-up ${command}",
match_for_absence => true,
}
} else {
# Use augeas to add an 'post-up' command to the interface
augeas { "${interface}_${title}":
incl => '/etc/network/interfaces',
lens => 'Interfaces.lns',
context => "/files/etc/network/interfaces/*[. = '${interface}']",
changes => "set post-up[last()+1] '${command}'",
onlyif => "match post-up[. = '${command}'] size == 0";
}
}
}
|