Skip to content

Instantly share code, notes, and snippets.

@Millnert
Created January 3, 2016 00:49
Show Gist options
  • Save Millnert/6adf130230458e6cc430 to your computer and use it in GitHub Desktop.
Save Millnert/6adf130230458e6cc430 to your computer and use it in GitHub Desktop.
quagga/service.pp
# Configures a service for quagga
class millnert::quagga::service {
if $millnert::quagga::restart_on_change {
$subscription_base = [
File['daemons'],
File['debian.conf'],
File['zebra.conf']
]
if $millnert::quagga::bgpd {
$subscription_bgpd = File['bgpd.conf']
notify{'have bgpd':}
} else {
$subscription_bgpd = []
}
if $millnert::quagga::ospfd {
$subscription_ospfd = File['ospfd.conf']
notify{"have ospfd: ${subscription_ospfd}":}
} else {
$subscription_ospfd = []
}
$subscription = concat($subscription_base, $subscription_ospfd)
notify {"subscription parameter: ${subscription}":}
} else {
$subscription = []
}
service { 'quagga':
ensure => 'running',
name => 'quagga',
enable => true,
subscribe => $subscription;
}
}
@Millnert
Copy link
Author

Millnert commented Jan 3, 2016

for node in question:
millnert::quagga::ospfd = true
millnert::quagga:restart_on_change = true
millnert::quagga::bgpd = false

output:
Notice: subscription parameter: File[daemons]File[debian.conf]File[zebra.conf]
Notice: /Stage[main]/Millnert::Quagga::Service/Notify[subscription parameter: File[daemons]File[debian.conf]File[zebra.conf]]/message: defined 'message' as 'subscription parameter: File[daemons]File[debian.conf]File[zebra.conf]'
Notice: have ospfd: File[ospfd.conf]
Notice: /Stage[main]/Millnert::Quagga::Service/Notify[have ospfd: File[ospfd.conf]]/message: defined 'message' as 'have ospfd: File[ospfd.conf]'

@Millnert
Copy link
Author

Millnert commented Jan 3, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment