-define ferm::conf ($content=undef, $source=undef, $ensure=present) {
-
- include ferm
-
+#
+define ferm::conf (
+ $source=undef,
+ $content=undef,
+ $ensure=present,
+ $prio="xx-10",
+) {
case $ensure {
- present,absent: {}
- default: { fail ( "Invald ensure `${ensure}' for ${name}" ) }
+ present: {
+ if ! ($source or $content) {
+ fail ( "No configuration found for ${name}" )
+ }
+ }
+ absent: {}
+ default: { fail ( "Unknown ensure value: '$ensure'" ) }
}
if ($source and $content) {
fail ( "Can't define both source and content for ${name}" )
}
- $fname = "/etc/ferm/conf.d/${name}.conf"
+ $fname = "/etc/ferm/conf.d/${prio}_${name}.conf"
- if $source {
+ if $content {
file { $fname:
- ensure => $ensure,
- source => $source,
- notify => Service['ferm']
+ ensure => $ensure,
+ mode => '0400',
+ content => $content,
+ notify => Exec["ferm restart"],
}
- } elsif $content {
+ } else {
file { $fname:
- ensure => $ensure,
- content => $content,
- notify => Service['ferm']
+ ensure => $ensure,
+ mode => '0400',
+ source => $source,
+ notify => Exec["ferm restart"],
}
}
}