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 (Any) (defaults to: '10')


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

class puppetmaster::gitsync(
    $run_every_minutes = '10',
) {

    ensure_packages([
        'python3-git',
        ])


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

    cron { 'rebase_operations_puppet':
        ensure  => present,
        user    => 'root',
        minute  => "*/${run_every_minutes}",
        command => '/usr/local/bin/git-sync-upstream >>/var/log/git-sync-upstream.log 2>&1',
        require => File['/usr/local/bin/git-sync-upstream'],
    }

    logrotate::conf { 'git-sync-upstream':
        ensure => present,
        source => 'puppet:///modules/puppetmaster/git-sync-upstream.logrotate',
    }

    sudo::user { 'cherry_pick_count':
        ensure     => present,
        user       => 'diamond',
        privileges => [ 'ALL = (root) NOPASSWD: /usr/bin/git --git-dir=/var/lib/git/operations/puppet/.git log --pretty=oneline --abbrev-commit origin/HEAD..HEAD' ],
    }

    diamond::collector { 'CherryPickCounter':
        ensure  => present,
        source  => 'puppet:///modules/puppetmaster/cherry-pick-counter-collector.py',
        require => Sudo::User['cherry_pick_count'],
    }
}