-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from ekohl/update-module
Drop Ubuntu 14.04, use more data types and drop UNSET defaults
- Loading branch information
Showing
6 changed files
with
158 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,4 @@ | |
docker_sets: | ||
- set: debian8-64 | ||
- set: debian9-64 | ||
- set: ubuntu1404-64 | ||
- set: ubuntu1604-64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,206 +1,173 @@ | ||
# == Class: bird | ||
# @summary Install and configure bird | ||
# @author Sebastien Badia <http://sebastien.badia.fr/> | ||
# @author Lorraine Data Network <http://ldn-fai.net/> | ||
# | ||
# Install and configure bird | ||
# | ||
# === Parameters | ||
# | ||
# [*config_file_v4*] | ||
# @param config_file_v4 | ||
# Bird configuration file for IPv4. | ||
# Default: UNSET. (this value is a puppet source, example 'puppet:///modules/bgp/bird.conf'). | ||
# | ||
# [*config_template_v4*] | ||
# Bird configuration template for IPv4. | ||
# Default: UNSET. (this value is a template source, it will be passed into the template() function). | ||
# @param config_template_v4 | ||
# Bird configuration template for IPv4. This value is a template source, it | ||
# will be passed into the template() function. | ||
# | ||
# [*daemon_name_v6*] | ||
# The service name used by puppet ressource | ||
# Default: bird6 | ||
# @param daemon_name_v6 | ||
# The service name used by puppet resource | ||
# | ||
# [*package_name_v6*] | ||
# The package name used by puppet ressource | ||
# Default: bird6 | ||
# @param package_name_v6 | ||
# The package name used by puppet resource | ||
# | ||
# [*daemon_name_v4*] | ||
# The service name used by puppet ressource | ||
# Default: bird | ||
# @param daemon_name_v4 | ||
# The service name used by puppet resource | ||
# | ||
# [*package_name_v4*] | ||
# The package name used by puppet ressource | ||
# Default: bird | ||
# @param package_name_v4 | ||
# The package name used by puppet resource | ||
# | ||
# [*config_path_v6*] | ||
# @param config_path_v6 | ||
# The full path of the v6 configuration file | ||
# Default: /etc/bird/bird6.conf | ||
# | ||
# [*config_path_v4*] | ||
# @param config_path_v4 | ||
# The full path of the v4 configuration file | ||
# Default: /etc/bird/bird.conf | ||
# | ||
# [*enable_v6*] | ||
# @param enable_v6 | ||
# Boolean for enable IPv6 (install bird6 package) | ||
# Default: false | ||
# | ||
# [*manage_conf*] | ||
# @param manage_conf | ||
# Boolean, global parameter to disable or enable mangagment of bird configuration files. | ||
# Default: false | ||
# | ||
# [*manage_service*] | ||
# @param manage_service | ||
# Boolean, global parameter to disable or enable mangagment of bird service. | ||
# Default: false | ||
# | ||
# [*service_v6_ensure*] | ||
# @param service_v6_ensure | ||
# Bird IPv6 daemon ensure (shoud be running or stopped). | ||
# Default: running | ||
# | ||
# [*service_v6_enable*] | ||
# @param service_v6_enable | ||
# Boolean, enabled param of Bird IPv6 service (run at boot time). | ||
# Default: false | ||
# | ||
# [*service_v4_ensure*] | ||
# @param service_v4_ensure | ||
# Bird IPv4 daemon ensure (shoud be running or stopped). | ||
# Default: running | ||
# | ||
# [*service_v4_enable*] | ||
# @param service_v4_enable | ||
# Boolean, enabled param of Bird IPv4 service (run at boot time). | ||
# Default: false | ||
# | ||
# [*config_file_v6*] | ||
# @param config_file_v6 | ||
# Bird configuration file for IPv6. | ||
# Default: UNSET. (this value is a puppet source, example 'puppet:///modules/bgp/bird6.conf'). | ||
# | ||
# [*config_template_v6*] | ||
# Bird configuration template for IPv6. | ||
# Default: UNSET. (this value is a template source, it will be passed into the template() function). | ||
# | ||
# === Examples | ||
# | ||
# class { 'bird': | ||
# enable_v6 => true, | ||
# config_file_v4 => 'puppet:///modules/bgp/ldn/bird.conf', | ||
# config_file_v6 => 'puppet:///modules/bgp/ldn/bird6.conf', | ||
# } | ||
# @param config_template_v6 | ||
# Bird configuration template for IPv6. This value is a template source, it | ||
# will be passed into the template() function. | ||
# | ||
# === Authors | ||
# @example IPv4 only | ||
# class { 'bird': | ||
# config_file_v4 => 'puppet:///modules/bgp/ldn/bird.conf', | ||
# } | ||
# | ||
# Sebastien Badia <http://sebastien.badia.fr/> | ||
# Lorraine Data Network <http://ldn-fai.net/> | ||
# | ||
# === Copyright | ||
# | ||
# Copyleft 2013 Sebastien Badia | ||
# See LICENSE file | ||
# @example Both IPv4 and IPv6 | ||
# class { 'bird': | ||
# enable_v6 => true, | ||
# config_file_v4 => 'puppet:///modules/bgp/ldn/bird.conf', | ||
# config_file_v6 => 'puppet:///modules/bgp/ldn/bird6.conf', | ||
# } | ||
# | ||
class bird ( | ||
$daemon_name_v4 = $bird::params::daemon_name_v4, | ||
$package_name_v4 = $bird::params::package_name_v4, | ||
$config_path_v4 = $bird::params::config_path_v4, | ||
$config_file_v4 = 'UNSET', | ||
$config_template_v4 = 'UNSET', | ||
String[1] $daemon_name_v4 = 'bird', | ||
String[1] $package_name_v4 = 'bird', | ||
Stdlib::Absolutepath $config_path_v4 = $bird::params::config_path_v4, | ||
Optional[Stdlib::Filesource] $config_file_v4 = undef, | ||
Optional[String[1]] $config_template_v4 = undef, | ||
Boolean $enable_v6 = false, | ||
Boolean $manage_conf = false, | ||
Boolean $manage_service = false, | ||
Enum['running', 'stopped'] $service_v6_ensure = 'running', | ||
Stdlib::Ensure::Service $service_v6_ensure = 'running', | ||
Boolean $service_v6_enable = false, | ||
Enum['running', 'stopped'] $service_v4_ensure = 'running', | ||
Stdlib::Ensure::Service $service_v4_ensure = 'running', | ||
Boolean $service_v4_enable = false, | ||
$daemon_name_v6 = $bird::params::daemon_name_v6, | ||
$package_name_v6 = $bird::params::package_name_v6, | ||
$config_path_v6 = $bird::params::config_path_v6, | ||
$config_file_v6 = 'UNSET', | ||
$config_template_v6 = 'UNSET', | ||
String[1] $daemon_name_v6 = 'bird6', | ||
String[1] $package_name_v6 = $bird::params::package_name_v6, | ||
Stdlib::Absolutepath $config_path_v6 = $bird::params::config_path_v6, | ||
Optional[Stdlib::Filesource] $config_file_v6 = undef, | ||
Optional[String[1]] $config_template_v6 = undef, | ||
) inherits bird::params { | ||
|
||
ensure_packages([$package_name_v4], {'ensure' => 'present'}) | ||
|
||
if $manage_service == true { | ||
service { | ||
$daemon_name_v4: | ||
ensure => $service_v4_ensure, | ||
enable => $service_v4_enable, | ||
hasrestart => false, | ||
restart => '/usr/sbin/birdc configure', | ||
hasstatus => false, | ||
pattern => $daemon_name_v4, | ||
require => Package[$package_name_v4]; | ||
if $manage_service { | ||
service { $daemon_name_v4: | ||
ensure => $service_v4_ensure, | ||
enable => $service_v4_enable, | ||
hasrestart => false, | ||
restart => '/usr/sbin/birdc configure', | ||
hasstatus => false, | ||
pattern => $daemon_name_v4, | ||
require => Package[$package_name_v4]; | ||
} | ||
} | ||
|
||
if $manage_conf == true { | ||
if $config_file_v4 == 'UNSET' and $config_template_v4 == 'UNSET' { | ||
if $manage_conf { | ||
unless $config_file_v4 or $config_template_v4 { | ||
fail("either config_file_v4 or config_template_v4 parameter must be set (config_file_v4: ${config_file_v4}, config_template_v4: ${config_template_v4})") | ||
} | ||
|
||
if $config_file_v4 { | ||
$config_file_v4_content = undef | ||
} else { | ||
if $config_file_v4 != 'UNSET' { | ||
file { | ||
$config_path_v4: | ||
ensure => file, | ||
source => $config_file_v4, | ||
owner => root, | ||
group => root, | ||
mode => '0644', | ||
notify => Service[$daemon_name_v4], | ||
require => Package[$package_name_v4]; | ||
} | ||
} else { | ||
file { | ||
$config_path_v4: | ||
ensure => file, | ||
content => template($config_template_v4), | ||
owner => root, | ||
group => root, | ||
mode => '0644', | ||
notify => Service[$daemon_name_v4], | ||
require => Package[$package_name_v4]; | ||
} | ||
} # config_file_v4 | ||
} # config_tmpl_v4 | ||
} # manage_conf | ||
$config_file_v4_content = template($config_template_v4) | ||
} | ||
|
||
file { $config_path_v4: | ||
ensure => file, | ||
source => $config_file_v4, | ||
content => $config_file_v4_content, | ||
owner => root, | ||
group => root, | ||
mode => '0644', | ||
require => Package[$package_name_v4]; | ||
} | ||
|
||
if $enable_v6 == true { | ||
if $manage_service { | ||
File[$config_path_v4] ~> Service[$daemon_name_v4] | ||
} | ||
} | ||
|
||
if $enable_v6 { | ||
|
||
ensure_packages([$package_name_v6], {'ensure' => 'present'}) | ||
|
||
if $manage_service == true { | ||
service { | ||
$daemon_name_v6: | ||
ensure => $service_v6_ensure, | ||
enable => $service_v6_enable, | ||
hasrestart => false, | ||
restart => '/usr/sbin/birdc6 configure', | ||
hasstatus => false, | ||
pattern => $daemon_name_v6, | ||
require => Package[$package_name_v6]; | ||
if $manage_service { | ||
service { $daemon_name_v6: | ||
ensure => $service_v6_ensure, | ||
enable => $service_v6_enable, | ||
hasrestart => false, | ||
restart => '/usr/sbin/birdc6 configure', | ||
hasstatus => false, | ||
pattern => $daemon_name_v6, | ||
require => Package[$package_name_v6]; | ||
} | ||
} | ||
|
||
if $manage_conf == true { | ||
if $config_file_v6 == 'UNSET' and $config_template_v6 == 'UNSET' { | ||
if $manage_conf { | ||
unless $config_file_v6 or $config_template_v6 { | ||
fail("either config_file_v6 or config_template_v6 parameter must be set (config_file_v6: ${config_file_v6}, config_template_v6: ${config_template_v6})") | ||
} | ||
|
||
if $config_file_v6 { | ||
$config_file_v6_content = undef | ||
} else { | ||
if $config_file_v6 != 'UNSET' { | ||
file { | ||
$config_path_v6: | ||
ensure => file, | ||
source => $config_file_v6, | ||
owner => root, | ||
group => root, | ||
mode => '0644', | ||
notify => Service[$daemon_name_v6], | ||
require => Package[$package_name_v6]; | ||
} | ||
} else { | ||
file { | ||
$config_path_v6: | ||
ensure => file, | ||
content => template($config_template_v6), | ||
owner => root, | ||
group => root, | ||
mode => '0644', | ||
notify => Service[$daemon_name_v6], | ||
require => Package[$package_name_v6]; | ||
} | ||
} # config_file_v6 | ||
} # config_tmpl_v6 | ||
} # manage_conf | ||
} # enable_v6 | ||
$config_file_v6_content = template($config_template_v6) | ||
} | ||
|
||
file { $config_path_v6: | ||
ensure => file, | ||
source => $config_file_v6, | ||
content => $config_file_v6_content, | ||
owner => root, | ||
group => root, | ||
mode => '0644', | ||
require => Package[$package_name_v6]; | ||
} | ||
|
||
if $manage_service { | ||
File[$config_path_v6] ~> Service[$daemon_name_v6] | ||
} | ||
} | ||
} | ||
|
||
} # Class:: bird | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.