puppet-neutron/manifests/agents/lbaas.pp
Yanis Guenane a63da90375 Add tag to package and service resources
In order to be able to take an action after all the packages of the
module have been installed/updated or all the services have been
started/restarted, we set a 'neutron-package' and 'neutron-service'
tag for each package and service of this module.

At the moment, there is a generic openstack tag that is not specific
enough if one wants to take action upon a single module change.

Use case :

If an action needs to be taken after all the packages have been
installed or updated : Package <| tag == 'neutron-package' |> -> X

Change-Id: I63ac9b1d806565eb1847ed0e36d393c6c7ea98ad
2015-07-27 11:41:07 +02:00

104 lines
3.3 KiB
Puppet

# == Class: neutron::agents:lbaas:
#
# Setups Neutron Load Balancing agent.
#
# === Parameters
#
# [*package_ensure*]
# (optional) Ensure state for package. Defaults to 'present'.
#
# [*enabled*]
# (optional) Enable state for service. Defaults to 'true'.
#
# [*manage_service*]
# (optional) Whether to start/stop the service
# Defaults to true
#
# [*debug*]
# (optional) Show debugging output in log. Defaults to false.
#
# [*interface_driver*]
# (optional) Defaults to 'neutron.agent.linux.interface.OVSInterfaceDriver'.
#
# [*device_driver*]
# (optional) Defaults to 'neutron_lbaas.services.loadbalancer.drivers.haproxy.namespace_driver.HaproxyNSDriver'.
#
# [*use_namespaces*]
# (optional) Allow overlapping IP (Must have kernel build with
# CONFIG_NET_NS=y and iproute2 package that supports namespaces).
# Defaults to true.
#
# [*user_group*]
# (optional) The user group.
# Defaults to $::neutron::params::nobody_user_group
#
# [*manage_haproxy_package*]
# (optional) Whether to manage the haproxy package.
# Disable this if you are using the puppetlabs-haproxy module
# Defaults to true
#
class neutron::agents::lbaas (
$package_ensure = present,
$enabled = true,
$manage_service = true,
$debug = false,
$interface_driver = 'neutron.agent.linux.interface.OVSInterfaceDriver',
$device_driver = 'neutron_lbaas.services.loadbalancer.drivers.haproxy.namespace_driver.HaproxyNSDriver',
$use_namespaces = true,
$user_group = $::neutron::params::nobody_user_group,
$manage_haproxy_package = true,
) {
include ::neutron::params
Neutron_config<||> ~> Service['neutron-lbaas-service']
Neutron_lbaas_agent_config<||> ~> Service['neutron-lbaas-service']
case $device_driver {
/\.haproxy/: {
Package <| title == $::neutron::params::haproxy_package |> -> Package <| title == 'neutron-lbaas-agent' |>
if $manage_haproxy_package {
ensure_packages([$::neutron::params::haproxy_package])
}
}
default: {
fail("Unsupported device_driver ${device_driver}")
}
}
# The LBaaS agent loads both neutron.ini and its own file.
# This only lists config specific to the agent. neutron.ini supplies
# the rest.
neutron_lbaas_agent_config {
'DEFAULT/debug': value => $debug;
'DEFAULT/interface_driver': value => $interface_driver;
'DEFAULT/device_driver': value => $device_driver;
'DEFAULT/use_namespaces': value => $use_namespaces;
'haproxy/user_group': value => $user_group;
}
Package['neutron'] -> Package['neutron-lbaas-agent']
Package['neutron-lbaas-agent'] -> Neutron_config<||>
Package['neutron-lbaas-agent'] -> Neutron_lbaas_agent_config<||>
package { 'neutron-lbaas-agent':
ensure => $package_ensure,
name => $::neutron::params::lbaas_agent_package,
tag => ['openstack', 'neutron-package'],
}
if $manage_service {
if $enabled {
$service_ensure = 'running'
} else {
$service_ensure = 'stopped'
}
}
service { 'neutron-lbaas-service':
ensure => $service_ensure,
name => $::neutron::params::lbaas_agent_service,
enable => $enabled,
require => Class['neutron'],
tag => 'neutron-service',
}
}