Puppet Class: klaxon

Defined in:
modules/klaxon/manifests/init.pp

Overview

SPDX-License-Identifier: Apache-2.0

Class: klaxon

Install and configure klaxon, a simple webapp for users to page SRE.

Parameters:

  • config (Klaxon::Klaxon_config)
  • install_dir (Stdlib::Unixpath) (defaults to: '/srv/klaxon')
  • port (Stdlib::Port) (defaults to: 4667)


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
# File 'modules/klaxon/manifests/init.pp', line 5

class klaxon(
    Klaxon::Klaxon_config $config,
    Stdlib::Unixpath $install_dir = '/srv/klaxon',
    Stdlib::Port $port = 4667,
) {
    ensure_packages(['gunicorn3', 'python3-cachetools', 'python3-dateutil', 'python3-flask', 'python3-requests'])

    $environ_file = '/var/lib/klaxon/environ_file'

    # TODO: a better deployment model.
    git::clone { 'operations/software/klaxon':
        ensure    => latest,
        directory => $install_dir,
        branch    => 'master',
    }

    group { 'klaxon':
        ensure => present,
        system => true,
    }

    user { 'klaxon':
        gid        => 'klaxon',
        shell      => '/bin/bash',
        system     => true,
        managehome => true,
        home       => '/var/lib/klaxon',
        require    => Group['klaxon'],
    }

    file { $environ_file:
        ensure  => 'file',
        owner   => 'root',
        group   => 'klaxon',
        mode    => '0440',
        require => User['klaxon'],
        content => template('klaxon/environ_file.erb'),
    }

    systemd::service { 'klaxon':
        ensure    => 'present',
        content   => systemd_template('klaxon'),
        restart   => true,
        subscribe => [
            Exec['git_pull_operations/software/klaxon'],
            File[$environ_file],
        ],
        require   => [
          User['klaxon'],
        ],
    }

    profile::auto_restarts::service { 'klaxon': }
}