Defined Type: netbox::autogit

Defined in:
modules/netbox/manifests/autogit.pp

Overview

Parameters:

  • owner (String) (defaults to: 'netbox')
  • group (String) (defaults to: 'www-data')
  • mode (String) (defaults to: '2755')
  • repo_path (Stdlib::Unixpath) (defaults to: '/srv/automation')
  • frontends (Array[Stdlib::Fqdn]) (defaults to: [])


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
59
60
61
62
63
# File 'modules/netbox/manifests/autogit.pp', line 21

define netbox::autogit (
    String $owner = 'netbox',
    String $group = 'www-data',
    String $mode = '2755',
    Stdlib::Unixpath $repo_path = '/srv/automation',
    Array[Stdlib::Fqdn] $frontends = [],
) {
    $git='/usr/bin/git --bare init'
    $repofullpath = "${repo_path}/${title}.git"
    $creates="${repofullpath}/config"

    file { [$repo_path, $repofullpath]:
        ensure => directory,
        owner  => $owner,
        group  => $group,
        mode   => $mode,
    }

    # Create a bare repository with git.
    exec { "initialize automation git repository ${title}":
        command => $git,
        creates => $creates,
        user    => $owner,
        group   => $group,
        cwd     => $repofullpath,
        require => File[$repofullpath],
    }

    # Deploy a post-update script so we can serve this via http.
    file { "${repofullpath}/hooks/post-update":
        source => 'puppet:///modules/netbox/autogit-post-update.sh',
        owner  => $owner,
        group  => $group,
        mode   => '0550',
    }

    file { "${repofullpath}/config":
        owner   => $owner,
        group   => $group,
        mode    => '0640',
        content => template('netbox/autogit-config.erb'),
    }
}