Puppet Class: profile::openstack::eqiad1::cumin::master

Defined in:
modules/profile/manifests/openstack/eqiad1/cumin/master.pp

Overview

profile::openstack::eqiad1::cumin::master

Profile for setting up a Cumin master for WMCS. It allows to install Cumin master also inside a WMCS Cloud VPS project.

Hiera Parameters required for a project-specific Cumin master

profile::openstack::eqiad1::cumin::project_ssh_priv_key_path

The absolute path of an SSH passphrase-protected private key available on the host local filesystem.

profile::openstack::eqiad1::cumin::aliases

Optional hash of Cumin aliases in the form:

key: 'alias query'
profile::openstack::eqiad1::puppetdb_host

FQDN (the form used in Puppet certificates, so .wmflabs for older hosts) of a project-local PuppetDB host, if any.

Parameters:

  • keystone_protocol (Any) (defaults to: lookup('profile::openstack::base::keystone::auth_protocol'))
  • keystone_api_fqdn (Stdlib::Fqdn) (defaults to: lookup('profile::openstack::eqiad1::keystone_api_fqdn'))
  • keystone_port (Any) (defaults to: lookup('profile::openstack::base::keystone::public_port'))
  • observer_username (Any) (defaults to: lookup('profile::openstack::base::observer_user'))
  • observer_password (Any) (defaults to: lookup('profile::openstack::eqiad1::observer_password'))
  • nova_dhcp_domain (Any) (defaults to: lookup('profile::openstack::eqiad1::nova::dhcp_domain'))
  • aliases (Hash) (defaults to: lookup('profile::openstack::eqiad1::cumin::aliases'))
  • project_ssh_priv_key_path (Any) (defaults to: lookup('profile::openstack::eqiad1::cumin::project_ssh_priv_key_path'))
  • region (Any) (defaults to: lookup('profile::openstack::eqiad1::region'))
  • puppetdb_host (Optional[Stdlib::Host]) (defaults to: lookup('profile::openstack::eqiad1::cumin::master::puppetdb_host', {default_value => undef}))


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
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'modules/profile/manifests/openstack/eqiad1/cumin/master.pp', line 20

class profile::openstack::eqiad1::cumin::master(
    $keystone_protocol = lookup('profile::openstack::base::keystone::auth_protocol'),
    Stdlib::Fqdn $keystone_api_fqdn = lookup('profile::openstack::eqiad1::keystone_api_fqdn'),
    $keystone_port = lookup('profile::openstack::base::keystone::public_port'),
    $observer_username = lookup('profile::openstack::base::observer_user'),
    $observer_password = lookup('profile::openstack::eqiad1::observer_password'),
    $nova_dhcp_domain = lookup('profile::openstack::eqiad1::nova::dhcp_domain'),
    Hash $aliases = lookup('profile::openstack::eqiad1::cumin::aliases'),
    $project_ssh_priv_key_path = lookup('profile::openstack::eqiad1::cumin::project_ssh_priv_key_path'),
    $region = lookup('profile::openstack::eqiad1::region'),
    Optional[Stdlib::Host] $puppetdb_host = lookup('profile::openstack::eqiad1::cumin::master::puppetdb_host', {default_value => undef}),
) {
        # TODO: simplify once hiera converts null properly to undef (this can be fixed now)
        if $::wmcs_project and $project_ssh_priv_key_path and $project_ssh_priv_key_path != '' and $project_ssh_priv_key_path != 'undef' {
            $is_project = true
            keyholder::agent { "cumin_openstack_${::wmcs_project}_master":
                trusted_groups => ['root'],
                priv_key_path  => $project_ssh_priv_key_path,
            }
        } else {
            $is_project = false
            keyholder::agent { 'cumin_openstack_master':
                trusted_groups => ['wmcs-roots', 'root'],
            }
        }

        # Explicitely require cumin's suggested packages to enable OpenStack backend,
        # --install-suggests would recursively install many more unwanted dependencies.
        # Install clustershell as it provides nodeset CLI that is useful to mangle host lists.
        package { ['clustershell', 'cumin']:
            ensure => present,
        }

        # Variables used also in config.yaml
        $cumin_log_path = '/var/log/cumin'
        $ssh_config_path = '/etc/cumin/ssh_config'

        file { $cumin_log_path:
            ensure  => directory,
            owner   => 'root',
            group   => 'root',
            mode    => '0750',
            require => Package['cumin'],
        }

        file { '/etc/cumin':
            ensure  => directory,
            owner   => 'root',
            group   => 'root',
            mode    => '0750',
            require => Package['cumin'],
        }

        file { '/etc/cumin/config.yaml':
            ensure  => 'present',
            owner   => 'root',
            group   => 'root',
            mode    => '0640',
            content => template('profile/openstack/eqiad1/cumin/config.yaml.erb'),
            require => File['/etc/cumin'],
        }

        file { '/etc/cumin/aliases.yaml':
            ensure  => present,
            owner   => 'root',
            group   => 'root',
            mode    => '0640',
            content => template('profile/openstack/eqiad1/cumin/aliases.yaml.erb'),
            require => File['/etc/cumin'],
        }

        file { $ssh_config_path:
            ensure  => present,
            owner   => 'root',
            group   => 'root',
            mode    => '0640',
            content => template('profile/openstack/eqiad1/cumin/ssh_config.erb'),
            require => File['/etc/cumin'],
        }

        if debian::codename::eq('buster') {
            apt::package_from_component { 'spicerack':
                component => 'component/spicerack',
                packages  => ['python3-tqdm'],
                priority  => 1002,
            }
        }

        $python_version = debian::codename() ? {
            'bullseye' => '3.9',
            'buster'   => '3.7',
            'stretch'  => '3.5',
            default    => fail("unsupported on ${debian::codename()}"),
        }

        file { "/usr/local/lib/python${python_version}/dist-packages/cumin_file_backend.py":
            ensure  => 'present',
            owner   => 'root',
            group   => 'root',
            mode    => '0640',
            source  => 'puppet:///modules/profile/openstack/eqiad1/cumin/cumin_file_backend.py',
            require => File['/etc/cumin'],
        }

        file { '/etc/nfs-mounts.yaml':
            ensure  => 'present',
            owner   => 'root',
            group   => 'root',
            mode    => '0444',
            content => template('labstore/nfs-mounts.yaml.erb'),
        }

        file { '/usr/local/sbin/nfs-hostlist':
            ensure  => 'present',
            owner   => 'root',
            group   => 'root',
            mode    => '0550',
            source  => 'puppet:///modules/profile/openstack/eqiad1/cumin/nfs_hostlist.py',
            require => [
                File['/etc/nfs-mounts.yaml'],
                File['/etc/cumin'],
            ],
        }
}