aboutsummaryrefslogtreecommitdiff
path: root/manifests/gitosis.pp
blob: 77c210e7804a4643067a010fbba6553eb228de0c (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
# This class handles a gitosis installation, with /var/git as the root for
# git repositories.

class gitosis inherits git {
  # directory for gitosis user and repositories
  file { "/var/git":
    ensure => directory,
    mode   => 0755,
    owner  => gitosis,
    group  => gitosis,
  }

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

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

  # the needed packages
  package { "gitosis": ensure => installed }

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

  # alters the user's home dir
  user { "gitosis":
    allowdupe => false,
    comment   => "git repository hosting,,,",
    ensure    => present,
    home      => "/var/git",
    shell     => "/bin/sh",
    gid       => "gitosis",
    groups    => [ "puppet" ],
    require   => Group["gitosis"],
  }

  # tries to get rid of ugly directory structure
  file { "/srv/gitosis":
    ensure  => absent,
    force   => true,
    backup => false,
    require => User["gitosis"],
  }

  # we also don't need /var/gitosis
  file { "/var/gitosis":
    ensure  => absent,
    force   => true,
    backup => false,
    require => User["gitosis"],
  }
}