1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
# == Class: nova::compute::libvirt::networks
#
# Configures networks managed by libvirt
#
# === Parameters:
#
# [*disable_default_network*]
# (optional) Whether or not delete the default network.
# Defaults to true.
#
class nova::compute::libvirt::networks(
Boolean $disable_default_network = true,
) {
include nova::deps
if $disable_default_network {
exec { 'libvirt-default-net-disable-autostart':
command => 'virsh net-autostart default --disable',
path => ['/bin', '/usr/bin'],
onlyif => [
'virsh net-info default 2>/dev/null',
'virsh net-info default 2>/dev/null | grep -i "^autostart:\s*yes"'
]
}
exec { 'libvirt-default-net-destroy':
command => 'virsh net-destroy default',
path => ['/bin', '/usr/bin'],
onlyif => [
'virsh net-info default 2>/dev/null',
'virsh net-info default 2>/dev/null | grep -i "^active:\s*yes"'
]
}
Service<| tag == 'libvirt-service' |>
-> Exec['libvirt-default-net-disable-autostart']
-> Exec['libvirt-default-net-destroy']
-> Service<| tag == 'nova-service' |>
}
}
|