Puppet Class: profile::toolforge::grid::base

Defined in:
modules/profile/manifests/toolforge/grid/base.pp

Overview

Parameters:

  • external_hostname (Any) (defaults to: hiera('profile::toolforge::external_hostname', undef))
  • external_ip (Any) (defaults to: hiera('profile::toolforge::external_ip', undef))
  • active_proxy (Any) (defaults to: hiera('profile::toolforge::active_proxy_host'))
  • etcdir (Any) (defaults to: hiera('profile::toolforge::etcdir'))
  • project_path (Any) (defaults to: lookup('profile::toolforge::grid::base::project_path'))
  • sge_root (Any) (defaults to: lookup('profile::toolforge::grid::base::sge_root'))
  • sysdir (Any) (defaults to: lookup('profile::toolforge::grid::base::sysdir'))
  • geconf (Any) (defaults to: lookup('profile::toolforge::grid::base::geconf'))
  • collectors (Any) (defaults to: lookup('profile::toolforge::grid::base::collectors'))


3
4
5
6
7
8
9
10
11
12
13
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
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
# File 'modules/profile/manifests/toolforge/grid/base.pp', line 3

class profile::toolforge::grid::base (
    $external_hostname = hiera('profile::toolforge::external_hostname', undef),
    $external_ip = hiera('profile::toolforge::external_ip', undef),
    $active_proxy = hiera('profile::toolforge::active_proxy_host'),
    $etcdir = hiera('profile::toolforge::etcdir'),
    $project_path = lookup('profile::toolforge::grid::base::project_path'),
    $sge_root = lookup('profile::toolforge::grid::base::sge_root'),
    $sysdir = lookup('profile::toolforge::grid::base::sysdir'),
    $geconf = lookup('profile::toolforge::grid::base::geconf'),
    $collectors = lookup('profile::toolforge::grid::base::collectors'),
) {

    class { '::labs_lvm': }

    # Weird use of NFS for config centralization.
    # Nodes drop their config into a directory.
    #  - SSH host keys for HBA
    #  - known_hosts
    $store  = "${sysdir}/store"

    exec {'ensure-grid-is-on-NFS':
        command => '/bin/false',
        unless  => "/usr/bin/timeout -k 5s 60s /usr/bin/test -e ${project_path}/herald",
    }

    file { $sysdir:
        ensure  => directory,
        owner   => 'root',
        group   => "${::labsproject}.admin",
        mode    => '2775',
        require => Exec['ensure-grid-is-on-NFS'],
    }

    file { $geconf:
        ensure  => directory,
        require => File[$sysdir],
    }

    file { $sge_root:
        ensure  => link,
        target  => $geconf,
        force   => true,
        require => File[$geconf],
    }

    file { $collectors:
        ensure  => directory,
        require => File[$geconf],
    }

    file { $store:
        ensure  => directory,
        owner   => 'root',
        group   => 'root',
        mode    => '0755',
        require => File[$sysdir],
    }

    file { "${store}/hostkey-${::fqdn}":
        ensure  => file,
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
        content => "${::fqdn},${::hostname},${::ipaddress} ssh-rsa ${::sshrsakey}\n${::fqdn},${::hostname},${::ipaddress} ecdsa-sha2-nistp256 ${::sshecdsakey}\n",
        require => File[$store],
    }

    if $::labsproject == 'tools' {
        # The following conflicts with the ssh-known-hosts stuff with puppetdb
        # TODO: Remove when adding puppetdb to tools
        exec { 'make_known_hosts':
            command => "/bin/cat ${store}/hostkey-* >/etc/ssh/ssh_known_hosts~",
            onlyif  => "/usr/bin/test -n \"\$(/usr/bin/find ${store} -maxdepth 1 \\( -type d -or -type f -name hostkey-\\* \\) -newer /etc/ssh/ssh_known_hosts~)\" -o ! -s /etc/ssh/ssh_known_hosts~",
            require => File[$store],
        }

        file { '/etc/ssh/ssh_known_hosts':
            ensure  => file,
            source  => '/etc/ssh/ssh_known_hosts~',
            owner   => 'root',
            group   => 'root',
            mode    => '0444',
            require => Exec['make_known_hosts'],
        }
    }

    File['/var/lib/gridengine'] -> Package <| title == 'gridengine-common' |>

    file { '/shared':
        ensure  => link,
        target  => "${project_path}/.shared",
        require => Exec['ensure-grid-is-on-NFS'],
    }

    file { "${geconf}/default/common/host_aliases":
        ensure => present,
        owner  => 'sgeadmin',
        group  => 'sgeadmin',
        mode   => '0555',
    } -> file_line { 'host_aliases':
        ensure => present,
        line   => "${facts['hostname']}.${::labsproject}.eqiad.wmflabs ${facts['hostname']}.${::labsproject}.eqiad1.wikimedia.cloud",
        path   => "${geconf}/default/common/host_aliases",
    }

    # Link to currently active proxy
    file { '/etc/active-proxy':
        ensure  => file,
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
        content => $active_proxy,
    }

    class { 'profile::prometheus::node_local_crontabs': }
}