Puppet Class: rancid

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

Overview

Really Awful Notorious CIsco config Differ

Parameters:

  • active_server (Stdlib::Fqdn)


2
3
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'modules/rancid/manifests/init.pp', line 2

class rancid (
    Stdlib::Fqdn $active_server
    ){

    package { 'rancid':
        ensure => present,
    }

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

    user { 'rancid':
        shell      => '/bin/sh',
        gid        => 'rancid',
        managehome => true,
        system     => true,
        home       => '/var/lib/rancid',
    }

    ::keyholder::agent { 'rancid':
        require        => Group['rancid'],
        trusted_groups => ['rancid'],
    }

    file { '/etc/rancid/rancid.conf':
        require => Package['rancid'],
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
        source  => 'puppet:///modules/rancid/rancid.conf',
    }

    file { '/var/lib/rancid/bin/oglogin':
        require => Package['rancid'],
        owner   => 'root',
        group   => 'root',
        mode    => '0755',
        source  => 'puppet:///modules/rancid/bin/oglogin',
    }

    file { '/var/lib/rancid/bin/ograncid':
        require => Package['rancid'],
        owner   => 'root',
        group   => 'root',
        mode    => '0755',
        source  => 'puppet:///modules/rancid/bin/ograncid',
    }

    file { '/var/lib/rancid/bin/ssh-serial-console-wrapper':
        require => Package['rancid'],
        owner   => 'root',
        group   => 'root',
        mode    => '0755',
        source  => 'puppet:///modules/rancid/bin/ssh-serial-console-wrapper',
    }

    file { '/var/lib/rancid/core':
        require => [ Package['rancid'], User['rancid'] ],
        owner   => 'rancid',
        group   => 'rancid',
        mode    => '0774',
        recurse => remote,
        source  => 'puppet:///modules/rancid/core',
    }

    file { '/var/lib/rancid/.cloginrc':
        require => Package['rancid'],
        owner   => 'rancid',
        group   => 'rancid',
        mode    => '0440',
        content => template('rancid/cloginrc.erb'),
    }

    file_line { 'opengear_script':
      path => '/etc/rancid/rancid.types.base',
      line => 'opengear;script;ograncid',
    }

    file_line { 'opengear_login':
      path => '/etc/rancid/rancid.types.base',
      line => 'opengear;login;oglogin',
    }

    if $active_server == $::fqdn {
        $cron_ensure = 'present'
    } else {
        $cron_ensure = 'absent'
    }

    cron { 'rancid_differ':
        ensure  => $cron_ensure,
        command => 'SSH_AUTH_SOCK=/run/keyholder/proxy.sock /usr/lib/rancid/bin/rancid-run',
        user    => 'rancid',
        minute  => '1',
    }

    cron { 'rancid_clean_logs':
        ensure  => $cron_ensure,
        command => '/usr/bin/find /var/log/rancid -type f -mtime +2 -exec rm {} \;',
        user    => 'rancid',
        minute  => '50',
        hour    => '23',
    }

    file { '/var/log/rancid':
        owner => 'rancid',
        group => 'rancid',
        mode  => '0750',
    }
}