puppet-neutron/manifests/agents/bigswitch.pp
Takashi Kajinami 4661d17814 Use anchor to require necessary packages/services
... so that correct packages and services are required without
re-defining them in resource implementations.

Change-Id: I031ea1bf8722593f9d2e326bce16801910971f97
2020-05-05 14:42:45 +09:00

78 lines
1.8 KiB
Puppet

# == Class: neutron::agents::bigswitch
#
# Installs and configures the Big Switch agent and lldp
#
# === Parameters
#
# [*package_ensure*]
# (optional) The state of the package
# Defaults to present
#
# [*lldp_enabled*]
# (optional) The state of the neutron-bsn-lldp service
# Defaults to true
#
# [*agent_enabled*]
# (optional) The state of the neutron-bsn-agent service
# Defaults to false
#
#
class neutron::agents::bigswitch (
$package_ensure = 'present',
$lldp_enabled = true,
$agent_enabled = false,
) {
include neutron::deps
include neutron::params
if($::osfamily != 'Redhat') {
fail("Unsupported osfamily ${::osfamily}")
}
ensure_packages("python${neutron::params::pyvers}-networking-bigswitch",
{
ensure => $package_ensure,
tag => ['openstack', 'neutron-package'],
}
)
package { 'bigswitch-lldp':
ensure => $package_ensure,
name => $::neutron::params::bigswitch_lldp_package,
tag => ['neutron-support-package', 'openstack'],
}
package { 'bigswitch-agent':
ensure => $package_ensure,
name => $::neutron::params::bigswitch_agent_package,
tag => ['neutron-support-package', 'openstack'],
}
if $lldp_enabled {
$lldp_service_ensure = 'running'
} else {
$lldp_service_ensure = 'stopped'
}
if $agent_enabled {
$agent_service_ensure = 'running'
} else {
$agent_service_ensure = 'stopped'
}
service { 'bigswitch-lldp':
ensure => $lldp_service_ensure,
name => $::neutron::params::bigswitch_lldp_service,
enable => $lldp_enabled,
tag => 'neutron-service',
}
service { 'bigswitch-agent':
ensure => $agent_service_ensure,
name => $::neutron::params::bigswitch_agent_service,
enable => $agent_enabled,
tag => 'neutron-service',
}
}