Puppet Class: puppetmaster::gitsync

Defined in:
modules/puppetmaster/manifests/gitsync.pp

Overview

Class: puppetmaster::gitsync

Sync local operations/puppet.git checkout with upstream.

Parameters:

  • run_every_minutes (Integer) (defaults to: 10)
  • private_only (Boolean) (defaults to: false)
  • prometheus_file (Optional[Stdlib::Unixpath]) (defaults to: '/var/lib/prometheus/node.d/puppet-gitsync.prom')


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
# File 'modules/puppetmaster/manifests/gitsync.pp', line 4

class puppetmaster::gitsync(
    Integer $run_every_minutes = 10,
    Boolean $private_only = false,
    Optional[Stdlib::Unixpath] $prometheus_file = '/var/lib/prometheus/node.d/puppet-gitsync.prom',
){

    ensure_packages([
        'python3-git',
        'python3-prometheus-client',
        'python3-requests',
    ])

    if $prometheus_file {
        $prometheus_arg = " --prometheus-file ${prometheus_file}"
    } else {
        $prometheus_arg = ''
    }

    $private_arg = $private_only.bool2str(' --private-only', '')

    file { '/usr/local/bin/git-sync-upstream':
        ensure => present,
        source => 'puppet:///modules/puppetmaster/git-sync-upstream.py',
        owner  => 'root',
        group  => 'root',
        mode   => '0555',
    }

    systemd::timer::job { 'puppet-git-sync-upstream':
        ensure      => 'present',
        user        => 'root',
        description => 'Update local Puppet repository copies',
        command     => "/usr/local/bin/git-sync-upstream ${prometheus_arg} ${private_arg}",
        interval    => {
            'start'    => 'OnUnitInactiveSec',
            'interval' => "${run_every_minutes}m",
        },
    }
}