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
|
# File 'modules/puppetmaster/manifests/gitsync.pp', line 7
class puppetmaster::gitsync (
Integer $run_every_minutes = 10,
Boolean $private_only = false,
Stdlib::Unixpath $prometheus_file = '/var/lib/prometheus/node.d/puppet-gitsync.prom',
Stdlib::Unixpath $base_dir = '/var/lib/git',
String[1] $git_user = 'root',
) {
ensure_packages([
'python3-git',
'python3-prometheus-client',
'python3-requests',
])
file { '/usr/local/bin/git-sync-upstream':
ensure => file,
source => 'puppet:///modules/puppetmaster/git-sync-upstream.py',
owner => 'root',
group => 'root',
mode => '0555',
}
$private_arg = $private_only.bool2str('--private-only', '')
$command = @("COMMAND"/L)
/usr/local/bin/git-sync-upstream --prometheus-file ${prometheus_file} \
--base-dir ${base_dir} \
${private_arg}
|- COMMAND
systemd::timer::job { 'puppet-git-sync-upstream':
ensure => 'present',
user => $git_user,
description => 'Update local Puppet repository copies',
command => $command,
interval => {
'start' => 'OnUnitInactiveSec',
'interval' => "${run_every_minutes}m",
},
}
}
|