Puppet Class: profile::netbox::automation

Defined in:
modules/profile/manifests/netbox/automation.pp

Overview

Class: profile::netbox::automation

This profile creates and exposes git repositories created by automation.

Actions:

Initialize git repositories
Create an apache site to expose these repositories.

Requires:

Sample Usage:

include profile::netbox::automation

Parameters:

  • automation_service_hostname (Stdlib::Fqdn) (defaults to: lookup('profile::netbox::automation::git_hostname'))
  • frontends (Array[Stdlib::Fqdn]) (defaults to: lookup('netbox_frontend', {'default_value' => []}))
  • has_acme (Boolean) (defaults to: lookup('profile::netbox::acme', {'default_value' => true}))
  • nb_api (Stdlib::HTTPSUrl) (defaults to: lookup('profile::netbox::netbox_api'))
  • nb_ro_token (String) (defaults to: lookup('profile::netbox::tokens::read_only'))
  • dns_min_records (Integer) (defaults to: lookup('profile::netbox::automation::dns_min_records'))


14
15
16
17
18
19
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
# File 'modules/profile/manifests/netbox/automation.pp', line 14

class profile::netbox::automation (
    Stdlib::Fqdn $automation_service_hostname = lookup('profile::netbox::automation::git_hostname'),
    Array[Stdlib::Fqdn] $frontends = lookup('netbox_frontend', {'default_value' => []}),
    Boolean $has_acme = lookup('profile::netbox::acme', {'default_value' => true}),
    Stdlib::HTTPSUrl $nb_api = lookup('profile::netbox::netbox_api'),
    String $nb_ro_token = lookup('profile::netbox::tokens::read_only'),
    Integer $dns_min_records = lookup('profile::netbox::automation::dns_min_records'),
) {
    $ssl_settings = ssl_ciphersuite('apache', 'strong', true)

    # Create automation git repositories
    $repo_path = '/srv/netbox-exports'
    $repos = ['dns']

    $repos.each |String $repo| {
        netbox::autogit { $repo:
            repo_path => $repo_path,
            frontends => $frontends,
        }
    }

    # Expose automation git repositories
    # (this reuses the Netbox certificates).
    httpd::site { $automation_service_hostname:
        content => template('profile/netbox/netbox-exports.wikimedia.org.erb'),
        require => Acme_chief::Cert['netbox'],
    }

    # Configuration for Netbox extras dns scripts
    $dns_repo_path = "${repo_path}/dns.git/"
    file { '/etc/netbox/dns.cfg':
        owner   => 'netbox',
        group   => 'netbox',
        mode    => '0440',
        content => template('profile/netbox/dns.cfg.erb'),
    }
}