Puppet Class: gitlab::config

Inherits:
gitlab
Defined in:
manifests/config.pp

Overview

Class

gitlab::config



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
# File 'manifests/config.pp', line 4

class gitlab::config inherits gitlab {
  File {
    owner => $git_user,
    group => $git_group,
  }

  $socket_path = "${git_home}/gitlab/tmp/sockets/gitlab.socket"
  $root_path = "${git_home}/gitlab/public"

  # gitlab
  if $gitlab_manage_nginx {
    file { '/etc/nginx/conf.d/gitlab.conf':
      ensure  => file,
      content => template('gitlab/nginx-gitlab.conf.erb'),
      owner   => root,
      group   => root,
      mode    => '0644',
      notify  => Service[$gitlab::webserver_service_name],
    }
  }

  file { '/etc/default/gitlab':
    ensure  => file,
    content => template('gitlab/gitlab.default.erb'),
    owner   => root,
    group   => root,
    mode    => '0644',
  }

  file { '/etc/init.d/gitlab':
    ensure  => file,
    source  => "${git_home}/gitlab/lib/support/init.d/gitlab",
    owner   => root,
    group   => root,
    mode    => '0755',
    require => File['/etc/default/gitlab'],
  }

  file { '/etc/logrotate.d/gitlab':
      ensure => file,
      source => "${git_home}/gitlab/lib/support/logrotate/gitlab",
      owner  => root,
      group  => root,
      mode   => '0644';
  }

  # directories
  file { [
      "${git_home}/gitlab/tmp",
      "${git_home}/gitlab/tmp/pids",
      "${git_home}/gitlab/tmp/sockets",
      "${git_home}/gitlab/log",
      "${git_home}/gitlab/public",
      "${git_home}/gitlab/public/uploads",
    ]:
    ensure => directory,
    mode   => '0755',
  }

  # symlink fix for python
  file { '/usr/bin/python2':
    ensure => link,
    owner  => root,
    group  => root,
    target => '/usr/bin/python';
  }

  # backup task
  $backup_file = '/usr/local/sbin/backup-gitlab.sh'

  $backup_ensure = $gitlab_backup? {
    true    => present,
    default => absent,
  }

  file { $backup_file:
    ensure  => $backup_ensure,
    content => template('gitlab/backup-gitlab.sh.erb'),
    mode    => '0755',
    owner   => 'root',
    group   => 'root',
  }

  cron { 'gitlab backup':
    ensure  => $backup_ensure,
    command => $backup_file,
    hour    => $gitlab_backup_time,
    minute  => fqdn_rand(60),
    user    => $git_user,
  }
}