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.erb')
  • bfd (Boolean) (defaults to: true)
  • bind_service (Optional[String]) (defaults to: undef)
  • do_ipv6 (Boolean) (defaults to: false)
  • multihop (Boolean) (defaults to: true)
  • ipv4_src (Stdlib::IP::Address) (defaults to: $facts['ipaddress'])
  • ipv6_src (Stdlib::IP::Address) (defaults to: $facts['ipaddress6'])


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
# File 'modules/bird/manifests/init.pp', line 29

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

  ensure_packages(['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 }

  # Install the backported bird2 package from bullseye if the host is buster.
  if debian::codename::eq('buster') {
      apt::package_from_component { 'bird2':
          component => 'component/bird2',
      }
  } else {
    ensure_packages(['bird2'])
  }

  systemd::service { 'bird':
      ensure         => present,
      restart        => true,
      content        => template('bird/bird.service.erb'),
      require        => [
          Package['bird2'],
      ],
      service_params => {
          restart => 'systemctl reload bird.service',
      },
  }

  systemd::service { 'bird6':
    ensure  => absent,
    restart => true,
    content => template('bird/bird.service.erb'),
  }

  file { '/etc/bird/bird6.conf':
      ensure  => absent,
  }

  file { '/etc/bird/bird.conf':
      ensure       => present,
      owner        => 'bird',
      group        => 'bird',
      mode         => '0640',
      content      => template($config_template),
      validate_cmd => '/usr/sbin/bird -p -c %',
      notify       => Systemd::Service['bird'],
  }

  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:1 -C bird',
      notes_url    => 'https://wikitech.wikimedia.org/wiki/Anycast#Bird_daemon_not_running',
  }
}