Puppet Class: bird

Defined in:
modules/bird/manifests/init.pp

Overview

Parameters:

  • neighbors (Array[Stdlib::IP::Address])
  • config_template (String) (defaults to: 'bird/bird_anycast.conf.epp')
  • bfd (Boolean) (defaults to: true)
  • bind_service (Optional[String]) (defaults to: undef)
  • do_ipv6 (Boolean) (defaults to: false)
  • routerid (Stdlib::IP::Address) (defaults to: $facts['ipaddress'])


29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'modules/bird/manifests/init.pp', line 29

class bird(
  Array[Stdlib::IP::Address] $neighbors,
  String                     $config_template = 'bird/bird_anycast.conf.epp',
  Boolean                    $bfd             = true,
  Optional[String]           $bind_service    = undef,
  Boolean                    $do_ipv6         = false,
  Stdlib::IP::Address        $routerid        = $facts['ipaddress'],
  ){

  ensure_packages(['bird', 'prometheus-bird-exporter'])

  $neighbors_v4 = $neighbors.filter |$neighbor| { $neighbor =~ Stdlib::IP::Address::V4::Nosubnet }
  $neighbors_v6 = $neighbors.filter |$neighbor| { $neighbor =~ Stdlib::IP::Address::V6::Nosubnet }

  if $bind_service {
    exec { 'bird-systemd-reload-enable':
        command     => 'systemctl daemon-reload; systemctl enable bird.service',
        path        => [ '/usr/bin', '/bin', '/usr/sbin' ],
        refreshonly => true,
    }
    file { '/lib/systemd/system/bird.service':
        ensure  => present,
        owner   => 'root',
        group   => 'root',
        mode    => '0644',
        content => template('bird/bird.service.erb'),
        require => Package['bird'],
        notify  => Exec['bird-systemd-reload-enable'],
    }
    systemd::service { 'bird6':
      ensure         => $do_ipv6.bool2str('present', 'absent'),
      restart        => true,
      content        => template('bird/bird6.service.erb'),
      require        => [
          Package['bird'],
      ],
      service_params => {
          restart => 'systemctl reload bird6.service',
      },
    }
  } else {
    service { 'bird6':
        enable  => true,
        restart => 'systemctl reload bird6.service',
        require => Package['bird'],
    }
  }

  service { 'bird':
      enable  => true,
      restart => 'service bird reload',
      require => Package['bird'],
  }

  file { '/etc/bird/bird.conf':
      ensure  => present,
      owner   => 'bird',
      group   => 'bird',
      mode    => '0640',
      content => epp($config_template, {'neighbors' => $neighbors_v4}),
      notify  => Service['bird'],
  }

  file { '/etc/bird/bird6.conf':
      ensure  => stdlib::ensure($do_ipv6, 'file'),
      owner   => 'bird',
      group   => 'bird',
      mode    => '0640',
      content => epp($config_template, {'do_ipv6' => $do_ipv6, 'neighbors' => $neighbors_v6}),
      notify  => Service['bird6'],
  }

  service { 'prometheus-bird-exporter':
      ensure     => running,
      enable     => true,
      hasrestart => true,
      require    => Package['prometheus-bird-exporter'],
  }

  file { '/etc/default/prometheus-bird-exporter':
      ensure => present,
      owner  => 'root',
      group  => 'root',
      mode   => '0444',
      source => 'puppet:///modules/bird/prometheus-bird-exporter.default',
      notify => Service['prometheus-bird-exporter'],
  }

  nrpe::monitor_service { 'bird':
      ensure       => present,
      description  => 'Bird Internet Routing Daemon',
      nrpe_command => '/usr/lib/nagios/plugins/check_procs -c 1:2 -C bird',
      notes_url    => 'https://wikitech.wikimedia.org/wiki/Anycast#Bird_daemon_not_running',
  }
}