Puppet Class: profile::base

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

Overview

Parameters:

  • use_apt_proxy (Boolean) (defaults to: lookup('profile::base::use_apt_proxy'))
  • purge_apt_sources (Boolean) (defaults to: lookup('profile::base::purge_apt_sources'))
  • purge_apt_preferences (Boolean) (defaults to: lookup('profile::base::purge_apt_preferences'))
  • domain_search (Any) (defaults to: hiera('profile::base::domain_search', $::domain))
  • nameservers (Any) (defaults to: hiera('profile::base::nameservers', $::nameservers))
  • remote_syslog (Any) (defaults to: hiera('profile::base::remote_syslog', []))
  • remote_syslog_tls (Any) (defaults to: hiera('profile::base::remote_syslog_tls', []))
  • enable_rsyslog_exporter (Any) (defaults to: hiera('profile::base::enable_rsyslog_exporter', false))
  • enable_kafka_shipping (Any) (defaults to: hiera('profile::base::enable_kafka_shipping', true))
  • notifications (Enum['critical', 'disabled', 'enabled']) (defaults to: hiera('profile::base::notifications', 'enabled'))
  • monitor_systemd (Any) (defaults to: hiera('profile::base::monitor_systemd', true))
  • core_dump_pattern (Any) (defaults to: hiera('profile::base::core_dump_pattern', '/var/tmp/core/core.%h.%e.%p.%t'))
  • ssh_server_settings (Any) (defaults to: hiera('profile::base::ssh_server_settings', {}))
  • group_contact (Any) (defaults to: hiera('contactgroups', 'admins'))
  • mgmt_group_contact (String) (defaults to: lookup('mgmt_contactgroups', {default_value => 'admins'}))
  • check_disk_options (Any) (defaults to: hiera('profile::base::check_disk_options', '-w 6% -c 3% -W 6% -K 3% -l -e -A -i "/srv/sd[a-b][1-3]" -i "/srv/nvme[0-9]n[0-9]p[0-9]" --exclude-type=fuse.fuse_dfs --exclude-type=tracefs'))
  • check_disk_critical (Any) (defaults to: hiera('profile::base::check_disk_critical', false))
  • check_raid_policy (Any) (defaults to: hiera('profile::base::check_raid_policy', ''))
  • check_raid_interval (Any) (defaults to: hiera('profile::base::check_raid_interval', 10))
  • check_raid_retry (Any) (defaults to: hiera('profile::base::check_raid_retry', 10))
  • check_raid (Boolean) (defaults to: lookup('profile::base::check_raid', {default_value => true}))
  • check_smart (Any) (defaults to: hiera('profile::base::check_smart', true))
  • overlayfs (Any) (defaults to: hiera('profile::base::overlayfs', false))
  • debdeploy_exclude_mounts (Any) (defaults to: lookup('profile::base::debdeploy::exclude_mounts'))
  • debdeploy_exclude_filesystems (Any) (defaults to: lookup('profile::base::debdeploy::exclude_filesystems'))
  • debdeploy_filter_services (Any) (defaults to: lookup('profile::base::debdeploy::filter_services', Hash, 'hash', {}))
  • monitoring_hosts (Any) (defaults to: hiera('monitoring_hosts', []))
  • wikimedia_clusters (Hash) (defaults to: lookup('wikimedia_clusters'))
  • cluster (String) (defaults to: lookup('cluster'))
  • enable_adduser (Boolean) (defaults to: lookup('profile::base::enable_adduser'))
  • hardware_monitoring (Wmflib::Ensure) (defaults to: lookup('profile::base::hardware_monitoring', {'default_value' => 'present'}))


1
2
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
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'modules/profile/manifests/base.pp', line 1

class profile::base(
    Boolean $use_apt_proxy = lookup('profile::base::use_apt_proxy'),
    Boolean $purge_apt_sources = lookup('profile::base::purge_apt_sources'),
    Boolean $purge_apt_preferences = lookup('profile::base::purge_apt_preferences'),
    $domain_search = hiera('profile::base::domain_search', $::domain), # lint:ignore:wmf_styleguide
    $nameservers   = hiera('profile::base::nameservers', $::nameservers), # lint:ignore:wmf_styleguide
    $remote_syslog = hiera('profile::base::remote_syslog', []),
    $remote_syslog_tls = hiera('profile::base::remote_syslog_tls', []),
    $enable_rsyslog_exporter = hiera('profile::base::enable_rsyslog_exporter', false),
    $enable_kafka_shipping = hiera('profile::base::enable_kafka_shipping', true),
    Enum['critical', 'disabled', 'enabled'] $notifications = hiera('profile::base::notifications', 'enabled'),
    $monitor_systemd = hiera('profile::base::monitor_systemd', true),
    $core_dump_pattern = hiera('profile::base::core_dump_pattern', '/var/tmp/core/core.%h.%e.%p.%t'),
    $ssh_server_settings = hiera('profile::base::ssh_server_settings', {}),
    $group_contact = hiera('contactgroups', 'admins'),
    String $mgmt_group_contact = lookup('mgmt_contactgroups', {default_value => 'admins'}),
    $check_disk_options = hiera('profile::base::check_disk_options', '-w 6% -c 3% -W 6% -K 3% -l -e -A -i "/srv/sd[a-b][1-3]" -i "/srv/nvme[0-9]n[0-9]p[0-9]" --exclude-type=fuse.fuse_dfs --exclude-type=tracefs'),
    $check_disk_critical = hiera('profile::base::check_disk_critical', false),
    # TODO/puppet4: revert to using "undef"
    $check_raid_policy = hiera('profile::base::check_raid_policy', ''),
    $check_raid_interval = hiera('profile::base::check_raid_interval', 10),
    $check_raid_retry = hiera('profile::base::check_raid_retry', 10),
    Boolean $check_raid = lookup('profile::base::check_raid', {default_value => true}),
    $check_smart = hiera('profile::base::check_smart', true),
    $overlayfs = hiera('profile::base::overlayfs', false),
    # We have included a default here as this seems to be the convention even though 
    # it contradicts https://wikitech.wikimedia.org/wiki/Puppet_coding
    # TODO: need to clarify with _joe_ when he comes back of vacation 2019-03-11
    $debdeploy_exclude_mounts = lookup('profile::base::debdeploy::exclude_mounts'),
    $debdeploy_exclude_filesystems = lookup('profile::base::debdeploy::exclude_filesystems'),
    $debdeploy_filter_services = lookup('profile::base::debdeploy::filter_services', Hash, 'hash', {}),
    $monitoring_hosts = hiera('monitoring_hosts', []),
    Hash $wikimedia_clusters = lookup('wikimedia_clusters'),
    String $cluster = lookup('cluster'),
    Boolean $enable_adduser = lookup('profile::base::enable_adduser'),
    Wmflib::Ensure $hardware_monitoring = lookup('profile::base::hardware_monitoring', {'default_value' => 'present'}),
) {
    # Sanity checks for cluster - T234232
    if ! has_key($wikimedia_clusters, $cluster) {
        fail("Cluster ${cluster} not defined in wikimedia_clusters")
    }

    if ! has_key($wikimedia_clusters[$cluster]['sites'], $::site) {
        fail("Site ${::site} not found in cluster ${cluster}")
    }

    contain profile::base::puppet
    require profile::base::certificates
    # Ensure we update the CA certificates before managing any services
    Exec['update-ca-certificates'] -> Service<| |>
    class { 'apt':
        use_proxy         => $use_apt_proxy,
        purge_sources     => $purge_apt_sources,
        purge_preferences => $purge_apt_preferences,
    }

    file { ['/usr/local/sbin', '/usr/local/share/bash']:
        ensure => directory,
        owner  => 'root',
        group  => 'root',
        mode   => '0755',
    }

    if $enable_adduser {
        class {'adduser': }
    }


    class { 'grub::defaults': }

    include passwords::root
    include network::constants

    class { 'base::resolving':
        domain_search => $domain_search,
        nameservers   => $nameservers,
    }

    class { 'rsyslog': }
    if $enable_rsyslog_exporter {
        include profile::prometheus::rsyslog_exporter

        class {'profile::rsyslog::kafka_shipper':
            enable => $enable_kafka_shipping,
        }
    }

    unless empty($remote_syslog) and empty($remote_syslog_tls) {
        class { 'base::remote_syslog':
            enable            => true,
            central_hosts     => $remote_syslog,
            central_hosts_tls => $remote_syslog_tls,
        }
    }

    #TODO: make base::sysctl a profile itself?
    class { 'base::sysctl': }
    class { 'motd': }
    class { 'base::standard_packages': }
    if os_version('debian <= buster') {
        class { 'toil::acct_handle_wtmp_not_rotated': }
    }
    class { 'base::environment':
        core_dump_pattern => $core_dump_pattern,
    }

    class { 'base::phaste': }
    class { 'base::screenconfig': }

    class { 'ssh::client': }

    # Ssh server default settings are good for most installs, but some overrides
    # might be needed

    create_resources('class', {'ssh::server' => $ssh_server_settings})

    class { 'nrpe':
        allowed_hosts => join($monitoring_hosts, ','),
    }

    class { 'base::kernel':
        overlayfs => $overlayfs,
    }

    if ($facts['is_virtual'] == false and $::processor0 !~ /AMD/) {
        class { 'prometheus::node_intel_microcode': }
    }

    class { 'base::debdeploy':
      exclude_mounts      => $debdeploy_exclude_mounts,
      exclude_filesystems => $debdeploy_exclude_filesystems,
      filter_services     => $debdeploy_filter_services,
    }

    if $facts['has_ipmi'] {
        class { 'ipmi::monitor':
            ensure => $hardware_monitoring
        }
    }

    class { 'base::initramfs': }
    class { 'base::auto_restarts': }

    $notifications_enabled = $notifications ? {
        'disabled' => '0',
        default    => '1',
    }

    class { 'base::monitoring::host':
        contact_group            => $group_contact,
        mgmt_contact_group       => $mgmt_group_contact,
        nrpe_check_disk_options  => $check_disk_options,
        nrpe_check_disk_critical => $check_disk_critical,
        raid_write_cache_policy  => $check_raid_policy,
        # for 'forking' checks (i.e. all but mdadm, which essentially just reads
        # kernel memory from /proc/mdstat) check every $check_raid_interval
        # minutes instead of default of one minute. If the check is non-OK, retry
        # every $check_raid_retry
        raid_check_interval      => $check_raid_interval,
        raid_retry_interval      => $check_raid_retry,
        notifications_enabled    => $notifications_enabled,
        is_critical              => ($notifications == 'critical'),
        monitor_systemd          => $monitor_systemd,
        puppet_interval          => $profile::base::puppet::interval,
        raid_check               => $check_raid,
        hardware_monitoring      => $hardware_monitoring
    }

    if $check_smart and $facts['is_virtual'] == false {
        class { 'smart': }
    }

    if $facts['is_virtual'] == false {
        include profile::prometheus::nic_saturation_exporter
    }

    # This is responsible for ~75%+ of all recdns queries...
    # https://phabricator.wikimedia.org/T239862
    host { 'statsd.eqiad.wmnet':
        ip           => '10.64.16.149', # graphite1004
        host_aliases => 'statsd',
    }

    if $facts['is_virtual'] == false {
        class { 'prometheus::node_nic_firmware': }
    }
}