]> gitweb.fluxo.info Git - puppet-git.git/commitdiff
Move common code to git::daemon
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 19 Jun 2015 21:27:01 +0000 (18:27 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 19 Jun 2015 21:27:01 +0000 (18:27 -0300)
manifests/daemon.pp
manifests/gitolite.pp
manifests/gitosis.pp

index 7dedce9c0155803052654572609044ffdc39eaa8..75c0af667828ac64f156dce92b697692195ac5a5 100644 (file)
@@ -1,6 +1,71 @@
 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': {
@@ -19,5 +84,6 @@ class git::daemon (
     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'],
   }
 }
index d5f448d4fcf43151d208241e908197d0c2250a21..9c230ea243bf0b7bdc7e22b4bddee536a237b272 100644 (file)
@@ -2,31 +2,6 @@
 # git repositories.
 
 class git::gitolite inherits git {
-  # directory for gitolite 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'],
-  }
-
   # the needed packages
   package { "gitolite":
      name   => $::lsbdistcodename ? {
@@ -39,28 +14,6 @@ class git::gitolite inherits git {
   # make sure this is not installed
   package { "gitosis": ensure => purged }
 
-  # ensures that the group exists
-  group { "git":
-    ensure    => present,
-    allowdupe => false,
-    require   => Package["gitolite3"],
-  }
-
-  # 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"],
-  }
-
   # tries to get rid of ugly directory structure
   file { "/srv/gitolite":
     ensure  => absent,
@@ -94,26 +47,6 @@ class git::gitolite inherits git {
     require => [ File['/var/git'], User['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'],
-  }
-
   # git-annex integration
   package { 'git-annex':
     ensure => present,
@@ -140,4 +73,3 @@ class git::gitolite inherits git {
     require => [ Package['git-annex'], File['/var/git/adc/ua'] ],
   }
 }
-
index 2463ea0434a9cb617990c3b783f7c14862d486a8..168e2a2260964a02022e9e824517db3970737d81 100644 (file)
@@ -2,52 +2,11 @@
 # git repositories.
 
 class git::gitosis inherits git {
-  # 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'],
-  }
-
   # the needed packages
   package { "gitosis": ensure => installed }
 
-  # ensures that the group exists
-  group { "git":
-    ensure    => present,
-    allowdupe => false,
-    require   => Package["gitosis"],
-  }
-
-  # alters the user's home dir
-  user { "git":
-    allowdupe => false,
-    comment   => "git repository hosting,,,",
-    ensure    => present,
-    home      => "/var/git",
-    shell     => "/bin/sh",
-    gid       => "git",
-    groups    => [ "puppet" ],
-    require   => Group["git"],
-  }
+  # make sure this is not installed
+  package { "gitolite": ensure => purged }
 
   # tries to get rid of ugly directory structure
   file { "/srv/gitosis":
@@ -64,23 +23,4 @@ class git::gitosis inherits git {
     backup => false,
     require => User["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'],
-  }
 }