Puppet Class: mwv

Defined in:
puppet/modules/mwv/manifests/init.pp

Overview

Class: mwv

General settings and configuration for mediawiki-vagrant deployments

Parameters

files_dir

Root directory for general file storage

etc_dir

/etc/ directory to use for storing MW-Vagrant-specific configuration files which need not to be shared with the host (example: '/etc/mw-vagrant').

services_dir

Root directory for provisioning new services to use in the VM

vendor_dir

Root directory for provisioning 3rd party services (eg Redis storage)

tld

Top level domain to use when creating hostnames. Value should include leading '.' (example: '.local.wmftest.net').

timezone

Timezone for the VM. (example: 'Etc/UTC')

Parameters:

  • files_dir (Any)
  • etc_dir (Any)
  • services_dir (Any)
  • vendor_dir (Any)
  • tld (Any)
  • timezone (Any)


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
# File 'puppet/modules/mwv/manifests/init.pp', line 27

class mwv (
    $files_dir,
    $etc_dir,
    $services_dir,
    $vendor_dir,
    $tld,
    $timezone,
) {
    include ::apt
    include ::env
    include ::git
    include ::mwv::packages
    include ::mwv::cachefilesd

    class { 'mwv::lang':
        stage => 'first',
    }
    # FIXME bandaid for T292324 until upgrading to buster and ensuring that
    # all base boxes are sufficiently recent
    class { 'mwv::hack':
        stage => 'first',
    }

    file { $etc_dir:
        ensure => directory,
        owner  => 'root',
        group  => 'root',
        mode   => '0755',
    }

    file { $vendor_dir:
        ensure => directory,
        owner  => 'root',
        group  => 'root',
        mode   => '0755',
    }

    # Ensure the uid/gid used for shared files exists in the VM
    if $::share_group =~ /^\d+$/ {
        group { 'vagrant_share':
            ensure    => 'present',
            gid       => $::share_group,
            allowdupe => true,
        } -> File <| |>
    }
    if $::share_owner =~ /^\d+$/ {
        user { 'vagrant_share':
            ensure    => 'present',
            uid       => $::share_owner,
            gid       => $::share_group,
            allowdupe => true,
        } -> File <| |>
    }

    # Why is this so hard?
    $tzparts = split($timezone, '/')
    $tzarea = $tzparts[0]
    $tzzone = $tzparts[1]
    exec { 'debconf tzarea':
        command => "/bin/echo tzdata tzdata/Areas select ${tzarea} | /usr/bin/debconf-set-selections",
        unless  => "/usr/bin/debconf-get-selections | /bin/grep -q -E \"^tzdata\\s+tzdata/Areas\\s+select\\s+${tzarea}\"",
        before  => Package['tzdata'],
    }
    exec { 'debconf tzzone':
        command => "/bin/echo tzdata tzdata/Zones/${tzarea} select ${timezone} | /usr/bin/debconf-set-selections",
        unless  => "/usr/bin/debconf-get-selections | /bin/grep -q -E \"^tzdata\\s+tzdata/Zones/${tzarea}\\s+select\\s+${timezone}\"",
        before  => Package['tzdata'],
    }
    file { '/etc/localtime':
        ensure  => 'link',
        target  => "/usr/share/zoneinfo/${timezone}",
        require => Package['tzdata'],
    }
    file { '/etc/timezone':
        ensure  => 'present',
        content => $timezone,
        require => Package['tzdata'],
    }

    # T236455: set hostname
    class { '::mwv::hostname':
        stage    => 'first',
        hostname => $::hostname,
        fqdn     => $::fqdn,
    }
}