aboutsummaryrefslogtreecommitdiff
path: root/manifests/daemon.pp
blob: 740a2addd7a71eaf1544344e3cd836cc03abbc90 (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
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
class git::daemon (
  $implementation = hiera('git::daemon::implementation', 'gitolite')
) {
  # directory for gitosis user and repositories
  file { "/var/git":
    ensure => directory,
    mode   => 0755,
    owner  => git,
    group  => git,
  }

  # repositories folder
  file { "/var/git/repositories":
    ensure  => directory,
    owner   => git,
    group   => git,
    mode    => 0755,
    recurse => false,
  }

  # symbolic link
  file { "/var/cache/git":
    ensure  => "/var/git/repositories",
    force   => true,
    backup  => false,
    require => File['/var/git/repositories'],
  }

  # ensures that the group exists
  group { "git":
    ensure    => present,
    allowdupe => false,
    require   => Package["gitolite"],
  }

  # alters the user's home dir
  # set '*' on password field to avoid this issue:
  # https://stackoverflow.com/questions/15664561/ssh-key-asks-for-password/15761971#15761971
  user { "git":
    allowdupe => false,
    comment   => "git repository hosting,,,",
    ensure    => present,
    home      => "/var/git",
    shell     => "/bin/sh",
    gid       => "git",
    password  => '*',
    groups    => [ "puppet" ],
    require   => Group["git"],
  }

  # mass update script
  file { "/usr/local/sbin/git-mass-update-server-info":
    ensure => present,
    owner  => root,
    group  => root,
    mode   => 0755,
    source => "puppet:///modules/git/git-mass-update-server-info",
  }

  # mass update hourly
  cron { "/usr/local/sbin/git-mass-update-server-info":
    command  => "/usr/local/sbin/git-mass-update-server-info &> /dev/null",
    user     => root,
    hour     => "*/1",
    minute   => "20",
    ensure   => present,
    require  => File['/usr/local/sbin/git-mass-update-server-info'],
  }

  case $implementation {
    'gitosis': {
      include git::gitosis
    }
    default: {
      include git::gitolite
    }
  }

  # the needed packages and services
  include inetd

  # git-daemon config in inetd
  line { "git-daemon-inetd":
    file   => "/etc/inetd.conf",
    line   => "git stream tcp nowait git /usr/bin/git git daemon --inetd --verbose --base-path=/var/git/repositories /var/git/repositories",
    ensure => present,
    notify => Service['inetd'],
  }

  # See http://bastian.rieck.ru/blog/posts/2013/gitweb_readme_workflow/
  #     https://stackoverflow.com/questions/8321649/gitweb-how-to-display-markdown-file-in-html-format-automatically-like-github
  package { 'markdown':
    ensure  => present,
  }
}