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'

Parameters:

  • keystone_protocol (Any) (defaults to: hiera('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: hiera('profile::openstack::base::keystone::public_port'))
  • observer_username (Any) (defaults to: hiera('profile::openstack::base::observer_user'))
  • observer_password (Any) (defaults to: hiera('profile::openstack::eqiad1::observer_password'))
  • nova_dhcp_domain (Any) (defaults to: hiera('profile::openstack::eqiad1::nova::dhcp_domain'))
  • aliases (Any) (defaults to: hiera('profile::openstack::eqiad1::cumin::aliases'))
  • project_ssh_priv_key_path (Any) (defaults to: hiera('profile::openstack::eqiad1::cumin::project_ssh_priv_key_path'))
  • region (Any) (defaults to: hiera('profile::openstack::eqiad1::region'))


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
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 16

class profile::openstack::eqiad1::cumin::master(
    $keystone_protocol = hiera('profile::openstack::base::keystone::auth_protocol'),
    Stdlib::Fqdn $keystone_api_fqdn = lookup('profile::openstack::eqiad1::keystone_api_fqdn'),
    $keystone_port = hiera('profile::openstack::base::keystone::public_port'),
    $observer_username = hiera('profile::openstack::base::observer_user'),
    $observer_password = hiera('profile::openstack::eqiad1::observer_password'),
    $nova_dhcp_domain = hiera('profile::openstack::eqiad1::nova::dhcp_domain'),
    $aliases = hiera('profile::openstack::eqiad1::cumin::aliases'),
    $project_ssh_priv_key_path = hiera('profile::openstack::eqiad1::cumin::project_ssh_priv_key_path'),
    $region = hiera('profile::openstack::eqiad1::region'),
    ) {
        validate_hash($aliases)

        # TODO: simplify once hiera converts null properly to undef
        if $::labsproject 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_${::labsproject}_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', 'python3-keystoneauth1', 'python3-keystoneclient', 'python3-novaclient']:
            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 os_version('debian == jessie') {
            $python_version = '3.4'
        } elsif os_version('debian == stretch') {
            $python_version = '3.5'
        } elsif os_version('debian == buster') {
            $python_version = '3.7'

            apt::package_from_component { 'spicerack':
                component => 'component/spicerack',
                packages  => ['python3-tqdm'],
                priority  => 1002,
            }

        } else {
            fail("Don't know which python3 version to use on this distribution")

        }

        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'],
            ],
        }
}