Puppet Class: bird::anycast_healthchecker

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

Summary

Overview

SPDX-License-Identifier: Apache-2.0 Install and configure the base of anycast_healthchecker https://github.com/unixsurfer/anycast_healthchecker

  • Global configuration file
  • pid directory
  • Services checks directory
  • Log directory
  • systemd service

The actual services checks are configured with bird::anycast_healthchecker_check

Parameters:

  • do_ipv6 (Boolean) (defaults to: false)

    configure ipv6

  • logging (Bird::Anycasthc_logging) (defaults to: {'level' => 'info', 'num_backups' => 8})

    The logging config hash

  • do_prom_exporter (Boolean) (defaults to: false)

    whether to enable the built-in Prometheus metrics (default: false)

  • prom_exporter_path (Stdlib::Unixpath) (defaults to: '/var/lib/prometheus/node.d/')

    if the above is enabled, path for directory where metrics are exported

  • prom_exporter_interval (Integer[30]) (defaults to: 60)

    the scraping period for the metrics

  • bind_service (Optional[Array[String[1], 1]]) (defaults to: undef)

    the service for systemd to bind to

  • supplementary_groups (Optional[Array[String[1], 1]]) (defaults to: undef)

    the additional supplementary group for the anycast-hc process



20
21
22
23
24
25
26
27
28
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
# File 'modules/bird/manifests/anycast_healthchecker.pp', line 20

class bird::anycast_healthchecker(
    Boolean                       $do_ipv6                = false,
    Bird::Anycasthc_logging       $logging                = {'level' => 'info', 'num_backups' => 8},
    Boolean                       $do_prom_exporter       = false,
    Stdlib::Unixpath              $prom_exporter_path     = '/var/lib/prometheus/node.d/',
    Integer[30]                   $prom_exporter_interval = 60,
    Optional[Array[String[1], 1]] $bind_service           = undef,
    Optional[Array[String[1], 1]] $supplementary_groups   = undef,
){

    ensure_packages(['anycast-healthchecker'])

    file {
        default:
            ensure  => file,
            owner   => 'bird',
            group   => 'bird',
            mode    => '0664',
            require => Package['anycast-healthchecker'];
        '/etc/anycast-healthchecker.conf':
            content      => template('bird/anycast-healthchecker.conf.erb'),
            validate_cmd => '/usr/bin/anycast-healthchecker -f % --check';
        '/etc/bird/anycast-prefixes.conf':
            replace      => false;  # The content is managed by anycast-healthchecker
        '/etc/bird/anycast6-prefixes.conf':
            replace      => false;  # The content is managed by anycast-healthchecker
    }

    systemd::tmpfile { 'var-run-anycast-healthchecker':
        content => 'd /var/run/anycast-healthchecker/ 0775 bird bird',
    }

    file {'/etc/anycast-healthchecker.d/':
        ensure  => directory,
        owner   => 'bird',
        group   => 'bird',
        mode    => '0775',
        purge   => true,
        recurse => true,
        notify  => Service['anycast-healthchecker'],
    }

    file {'/var/log/anycast-healthchecker/':
        ensure  => directory,
        owner   => 'bird',
        group   => 'bird',
        mode    => '0775',
        recurse => true,
        before  => Service['anycast-healthchecker'],
    }

    if $bind_service {
        $bind_service_with_ext = $bind_service.map |$srv| {
            $srv ? {
                Systemd::Service::Name => $srv,
                default                => "${srv}.service"
            }
        }
    }
    systemd::service { 'anycast-healthchecker':
        content        => template('bird/anycast-healthchecker.service.erb'),
        require        => [
            File[
                '/etc/anycast-healthchecker.conf',
                '/var/log/anycast-healthchecker/',
                '/etc/anycast-healthchecker.d/',
            ],
            Systemd::Tmpfile['var-run-anycast-healthchecker'],
        ],
        restart        => true,
        service_params => {
            ensure  => 'running', # lint:ignore:ensure_first_param
            require => Service[$bind_service],
            before  => Service['bird'],
        },
    }
}