Defined Type: slothslos::deploy::instance

Defined in:
modules/slothslos/manifests/deploy/instance.pp

Summary

Manage role-independent resources for SlothSLOS deployments

Overview

SPDX-License-Identifier: Apache-2.0 This class creates a directory to store the output of sloth generate and deploys the script responsible for managing the deployment (slothslos-deploy.py). It also sets up a systemd target that can be used to trigger slothslos-deploy.py after the Git repository has been updated.

Parameters:

  • manifests_dir (Stdlib::Unixpath) —

    The directory where manifests are stored.

  • deploy_dir (Stdlib::Unixpath) —

    The directory where the generated rules will be deployed.

  • git_repo_name (String[1]) —

    The name of the Git repository to be cloned.

  • git_repo_branch (String[1]) (defaults to: 'main') —

    The branch of the Git repository to be cloned.

  • ensure (Wmflib::Ensure) (defaults to: present) —

    Whether the resources should be present or absent.



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
# File 'modules/slothslos/manifests/deploy/instance.pp', line 14

define slothslos::deploy::instance (
    Stdlib::Unixpath $manifests_dir,
    Stdlib::Unixpath $deploy_dir,
    String[1] $git_repo_name,
    String[1] $git_repo_branch = 'main',
    Wmflib::Ensure $ensure = present,
) {
    if !defined(File[$deploy_dir]) {
        file { $deploy_dir:
            ensure => stdlib::ensure($ensure, 'directory'),
            owner  => $slothslos::user,
            group  => $slothslos::user,
            mode   => '0755',
        }
    }

    $service_name = "slothslos-flatten@${title}"

    systemd::unit { $service_name:
        ensure  => $ensure,
        content => systemd_template('slothslos-flatten@'),
        before  => [Git::Clone[$git_repo_name], Systemd::Service["slothslos-flatten@${title}"]],
    }

    systemd::service { $service_name:
        ensure    => $ensure,
        unit_type => 'path',
        content   => systemd_template('slothslos-flatten@.path'),
        team      => 'Observability',
        before    => Git::Clone[$git_repo_name],
    }
}