Puppet Class: profile::spicerack

Defined in:
modules/profile/manifests/spicerack.pp

Overview

Parameters:

  • tcpircbot_host (String) (defaults to: hiera('tcpircbot_host'))
  • tcpircbot_port (Stdlib::Port) (defaults to: hiera('tcpircbot_port'))
  • redis_shards (Hash) (defaults to: hiera('redis::shards'))
  • ganeti_user (String) (defaults to: hiera('profile::ganeti::rapi::ro_user'))
  • ganeti_password (String) (defaults to: hiera('profile::ganeti::rapi::ro_password'))
  • ganeti_timeout (Integer) (defaults to: hiera('profile::spicerack::ganeti_rapi_timeout', 30))
  • netbox_api (Stdlib::HTTPUrl) (defaults to: lookup('netbox::api_url'))
  • netbox_token_ro (String) (defaults to: lookup('netbox::ro_token'))
  • netbox_token_rw (String) (defaults to: lookup('netbox::rw_token'))
  • http_proxy (String) (defaults to: lookup('http_proxy'))


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
144
# File 'modules/profile/manifests/spicerack.pp', line 25

class profile::spicerack(
    String $tcpircbot_host = hiera('tcpircbot_host'),
    Stdlib::Port $tcpircbot_port = hiera('tcpircbot_port'),
    Hash $redis_shards = hiera('redis::shards'),
    String $ganeti_user = hiera('profile::ganeti::rapi::ro_user'),
    String $ganeti_password = hiera('profile::ganeti::rapi::ro_password'),
    Integer $ganeti_timeout = hiera('profile::spicerack::ganeti_rapi_timeout', 30),
    Stdlib::HTTPUrl $netbox_api = lookup('netbox::api_url'),
    String $netbox_token_ro = lookup('netbox::ro_token'),
    String $netbox_token_rw = lookup('netbox::rw_token'),
    String $http_proxy = lookup('http_proxy'),
) {
    # Ensure pre-requisite profiles are included
    require ::profile::conftool::client
    require ::profile::cumin::master
    require ::profile::ipmi::mgmt
    require ::profile::access_new_install
    require ::profile::conftool::client

    include ::service::deploy::common
    include ::passwords::redis

    # Packages required by spicerack cookbooks
    require_package('python3-dateutil', 'python3-requests')

    apt::package_from_component { 'spicerack':
        component => 'component/spicerack',
        packages  => ['spicerack']
    }

    $cookbooks_dir = '/srv/deployment/spicerack'

    # Install the cookbooks
    git::clone { 'operations/cookbooks':
        ensure    => 'latest',
        directory => $cookbooks_dir,
    }

    # Install the global configuration, the directory is already created by the Debian package
    file { '/etc/spicerack/config.yaml':
        ensure  => present,
        owner   => 'root',
        group   => 'ops',
        mode    => '0440',
        content => template('profile/spicerack/config.yaml.erb'),
    }

    # Install the Redis-specific configuration
    file { '/etc/spicerack/redis_cluster':
        ensure => directory,
        owner  => 'root',
        group  => 'ops',
        mode   => '0550',
    }

    $redis_sessions_data = {
        'password' => $passwords::redis::main_password,
        'shards' => $redis_shards['sessions'],
    }
    file { '/etc/spicerack/redis_cluster/sessions.yaml':
        ensure  => present,
        owner   => 'root',
        group   => 'ops',
        mode    => '0440',
        content => ordered_yaml($redis_sessions_data),
    }

    # Install Ganeti RAPI configuration
    file { '/etc/spicerack/ganeti':
        ensure => directory,
        owner  => 'root',
        group  => 'ops',
        mode   => '0550',
    }
    $ganeti_auth_data = {
        'username' => $ganeti_user,
        'password' => $ganeti_password,
        'timeout'  => $ganeti_timeout,
    }
    file { '/etc/spicerack/ganeti/config.yaml':
        ensure  => present,
        owner   => 'root',
        group   => 'ops',
        mode    => '0440',
        content => ordered_yaml($ganeti_auth_data),
    }
    # Install Netbox backend configuration
    file { '/etc/spicerack/netbox':
        ensure => directory,
        owner  => 'root',
        group  => 'ops',
        mode   => '0550',
    }
    $netbox_config_data = {
        'api_url'   => $netbox_api,
        'api_token_ro' => $netbox_token_ro,
        'api_token_rw' => $netbox_token_rw,
    }
    file { '/etc/spicerack/netbox/config.yaml':
        ensure  => present,
        owner   => 'root',
        group   => 'ops',
        mode    => '0440',
        content => ordered_yaml($netbox_config_data),
    }

    file { '/etc/spicerack/cookbooks':
        ensure => directory,
        owner  => 'root',
        group  => 'ops',
        mode   => '0550',
    }
    file { '/etc/spicerack/cookbooks/sre.network.cf.yaml':
        ensure  => present,
        owner   => 'root',
        group   => 'ops',
        mode    => '0440',
        content => secret('spicerack/cookbooks/sre.network.cf.yaml'),
    }
}