summaryrefslogtreecommitdiff
path: root/manifests/daemon.pp
blob: c7df2af1eac2d284e770d29e75e272ee80b71b6f (plain)
1
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
class git::daemon {
    include git
    package{'git-daemon':
        ensure => installed,
        require => Package['git'],
    }

    include xinetd
    file{'/etc/xinetd.d/git':
      require => Package['git-daemon','xinetd'],
      notify => Service[xinetd],
      owner => root, group => 0, mode => 0755;
    }
    file{'/etc/init.d/git-daemon':
      require => Package['git-daemon'],
      owner => root, group => 0, mode => 0755;
    }
    file{'/etc/sysconfig/git-daemon':
      require => Package['git-daemon'],
      owner => root, group => 0, mode => 0644;
    }
    service{'git-daemon':
      hasstatus => true,
    }
    if $git_daemon == 'service' {
      File['/etc/xinet.d/git']{
        source => "puppet:///modules/git/xinetd.d/git.disabled"
      }
      File['/etc/init.d/git-daemon']{
        source => [ "puppet:///modules/site-git/init.d/${fqdn}/git-daemon",
                    "puppet:///modules/site-git/init.d/git-daemon",
                    "puppet:///modules/git/init.d/git-daemon" ],
      }
      File['/etc/sysconfig/git-daemon']{
        source => [ "puppet:///modules/site-git/sysconfig/${fqdn}/git-daemon",
                    "puppet:///modules/site-git/sysconfig/git-daemon",
                    "puppet:///modules/git/sysconfig/git-daemon" ],
      }
      Service['git-daemon']{
        ensure => running,
        enable => true,
        require => [ File['/etc/sysconfig/git-daemon'], File['/etc/init.d/git-daemon'] ],
      }
    } else {
      File['/etc/xinetd.d/git']{
        source => [ "puppet:///modules/site-git/xinetd.d/${fqdn}/git",
                    "puppet:///modules/site-git/xinetd.d/git",
                    "puppet:///modules/git/xinetd.d/git" ],
      }
      Service['git-daemon']{
        ensure => stopped,
        enable => false,
        before => [ File['/etc/sysconfig/git-daemon'], File['/etc/init.d/git-daemon'] ],
      }
      File['/etc/init.d/git-daemon','/etc/sysconfig/git-daemon']{
        ensure => absent,
      }
    }

    if $use_shorewall {
      include shorewall::rules::gitdaemon
    }
}