Puppet Class: profile::base

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

Summary

profile to configure base config

Overview

SPDX-License-Identifier: Apache-2.0

Parameters:

  • overlayfs (Boolean) (defaults to: lookup('profile::base::overlayfs')) —

    if to use overlays

  • wikimedia_clusters (Hash) (defaults to: lookup('wikimedia_clusters')) —

    the wikimedia clusters

  • cluster (String) (defaults to: lookup('cluster')) —

    the cluster

  • enable_contacts (Boolean) (defaults to: lookup('profile::base::enable_contacts')) —

    use the contacts module

  • core_dump_pattern (String) (defaults to: lookup('profile::base::core_dump_pattern')) —

    the core dump pattern

  • unprivileged_userns_clone (Boolean) (defaults to: lookup('profile::base::unprivileged_userns_clone')) —

    enable kernel.unprivileged_userns_clone

  • additional_purged_packages (Array[String[1]]) (defaults to: lookup('profile::base::additional_purged_packages')) —

    A list of additional packages to purge

  • manage_resolvconf (Boolean) (defaults to: lookup('profile::base::manage_resolvconf', {'default_value' => true})) —

    set this to false to disable managing resolv.conf useful in container environments

  • rp_filter. —

    This variable is overloaded for backwards compatibility purposes. By default it is set to true, set this to false to disable rp_filtering. However you can also pass a hash with 2 keys: all_rp_filter and default_rp_filter which allows you to configure those with any of the 3 possible values individually

  • no_cron (Boolean) (defaults to: lookup('profile::base::no_cron', {'default_value' => false})) —

    If enabled, don't depend on the presence of a cron daemon. In a standard installation we still have common packages which depend on a cron-compatible daemon, but there are already use cases in Cloud VPS where cron isn't necessary. With increased adoption of systemd timers, this might also be applicable for a future baremetal installation. For now this option only omits the automated service restarts for cron.

  • use_linux612_on_bookworm (Boolean) (defaults to: lookup('profile::base::use_linux612_on_bookworm', {'default_value' => false})) —

    install the linux 6.12 kernel from backports on Bookworm.

  • use_linux_from_bpo_on_trixie (Boolean) (defaults to: lookup('profile::base::use_linux_from_bpo_on_trixie', {'default_value' => false})) —

    install the linux 6.16+ kernel from backports on Trixie.

  • remove_python2_on_bullseye (Boolean) (defaults to: lookup('profile::base::remove_python2_on_bullseye', {'default_value' => true}))
  • rp_filter (Variant[Boolean, Hash]) (defaults to: lookup('profile::base::enable_rp_filter', {'default_value' => true}))
  • tighten_ptrace (Boolean) (defaults to: lookup('profile::base::tighten_ptrace', {'default_value' => false}))


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
# File 'modules/profile/manifests/base.pp', line 22

class profile::base (
    Hash                                $wikimedia_clusters                 = lookup('wikimedia_clusters'),
    String                              $cluster                            = lookup('cluster'),
    Boolean                             $overlayfs                          = lookup('profile::base::overlayfs'),
    Boolean                             $enable_contacts                    = lookup('profile::base::enable_contacts'),
    String                              $core_dump_pattern                  = lookup('profile::base::core_dump_pattern'),
    Boolean                             $unprivileged_userns_clone          = lookup('profile::base::unprivileged_userns_clone'),
    Boolean                             $remove_python2_on_bullseye         = lookup('profile::base::remove_python2_on_bullseye', {'default_value' => true}),
    Boolean                             $manage_resolvconf                  = lookup('profile::base::manage_resolvconf', {'default_value' => true}),
    Array[String[1]]                    $additional_purged_packages         = lookup('profile::base::additional_purged_packages'),
    Variant[Boolean, Hash]              $rp_filter                          = lookup('profile::base::enable_rp_filter', {'default_value' => true}),
    Boolean                             $no_cron                            = lookup('profile::base::no_cron', {'default_value' => false}),
    Boolean                             $use_linux612_on_bookworm           = lookup('profile::base::use_linux612_on_bookworm', {'default_value' => false}),
    Boolean                             $use_linux_from_bpo_on_trixie       = lookup('profile::base::use_linux_from_bpo_on_trixie', {'default_value' => false}),
    Boolean                             $tighten_ptrace                     = lookup('profile::base::tighten_ptrace', {'default_value' => false}),
) {
    # Sanity checks for cluster - T234232
    if ! ($cluster in $wikimedia_clusters) {
        fail("Cluster ${cluster} not defined in wikimedia_clusters")
    }

    # create standard directories
    # perform this here and early to avoid dependency cycles
    file { ['/usr/local/sbin', '/usr/local/share/bash']:
        ensure => directory,
        owner  => 'root',
        group  => 'root',
        mode   => '0755',
    }

    include profile::adduser
    contain profile::puppet::agent
    contain profile::base::certificates
    include profile::apt
    if !$facts['wmflib']['is_container'] and $manage_resolvconf {
        include profile::systemd::timesyncd
    }
    unless $facts['wmflib']['is_container']  {
        class { 'grub::defaults': }
    }

    if $use_linux612_on_bookworm {
        # We need to explicitly list the linux-base's version since the package
        # is already installed when puppet runs, and without a specific
        # pinned version we ended up in linux-image refusing to install
        # because of linux-base not being installed with its expected version.
        apt::package_from_bpo { 'linux-6.12-bookworm':
            packages => {
                'linux-base'                       => '4.12.1~bpo12+1',
                'linux-image-6.12.113+deb12-amd64' => 'present',
            },
            distro   => 'bookworm',
        }
    }

    # Only used by ML's big GPU machines at the moment (20260729)
    if $use_linux_from_bpo_on_trixie {
        apt::package_from_bpo { 'linux-7.2-trixie':
            # Same as above: linux-base needs an explicit version, both so Puppet
            # actually upgrades the already-installed package, and because apt's
            # solver won't pull in a backports NotAutomatic version to satisfy a
            # PreDepends unless it's named explicitly with its version.
            packages => {
                'linux-base'                     => '4.17~bpo13+1',
                'linux-image-7.2.11+deb13-amd64' => 'present',
            },
            distro   => 'trixie',
        }
    }

    include passwords::root
    include network::constants
    if $manage_resolvconf {
        include profile::resolving
    }
    include profile::mail::default_mail_relay

    include profile::logrotate
    include profile::prometheus::node_exporter
    include profile::rsyslog
    include profile::syslog::remote
    include profile::prometheus::rsyslog_exporter
    include profile::prometheus::cadvisor
    include profile::prometheus::ethtool_exporter

    if !$facts['wmflib']['is_container'] {
        # If passed a Boolean, we know that we either want it consistent across all settings.
        if $rp_filter.is_a(Boolean) {
            $default_rp_filter = bool2num($rp_filter)
            $all_rp_filter = $default_rp_filter
            # But if we are passed a struct, then we know the caller has specific needs,
            # honor them without breaking backwards compatibility
        } elsif $rp_filter.is_a(Hash) {
            $default_rp_filter = $rp_filter['default_rp_filter']
            $all_rp_filter = $rp_filter['all_rp_filter']
        } else {
            fail('rp_filter is not a Boolean or Hash, bailing out')
        }
        # TODO: make base::sysctl a profile itself?
        class { 'base::sysctl':
            unprivileged_userns_clone => $unprivileged_userns_clone,
            default_rp_filter         => $default_rp_filter,
            all_rp_filter             => $all_rp_filter
        }
    }
    class { 'motd': }
    # Indicate if any services need to be restarted
    motd::script { 'Check for restarts':
        priority => 99,
        source   => 'puppet:///modules/profile/motd/check_restarts.sh',
    }
    class { 'base::standard_packages':
        remove_python2             => $remove_python2_on_bullseye,
        additional_purged_packages => $additional_purged_packages,
        no_cron                    => $no_cron,
    }

    class { 'acct':
        # In Trixie and older the package depends on Cron to manage
        # log rotation. In Forky and newer, the package will ship its
        # own logrotate configuration, so we can rely on that instead
        # of shipping our own.
        manage_logrotate => $no_cron and debian::codename::le('trixie'),
    }

    include profile::environment
    class { 'base::sysctl::core_dumps':
        core_dump_pattern => $core_dump_pattern,
    }

    include profile::ssh::client
    include profile::ssh::server

    if !$facts['wmflib']['is_container'] {
        class { 'base::kernel':
            overlayfs => $overlayfs,
        }
    }

    include profile::debdeploy::client

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

    class { 'prometheus::node_debian_version': }
    class { 'prometheus::node_dpkg_success': }

    sslcert::deselect { [
        'mozilla/emSign_ECC_Root_CA_-_C3.crt',
        'mozilla/emSign_ECC_Root_CA_-_G3.crt',
        'mozilla/emSign_Root_CA_-_C1.crt',
        'mozilla/emSign_Root_CA_-_G1.crt',
    ]: }
}