summaryrefslogtreecommitdiff
path: root/puppet/modules/leap_mx/manifests/init.pp
blob: 6bcdd19a98f3d3fc9a838f7cfa0e79b5bcae5ea8 (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
class leap_mx {

  $leap_mx          = hiera('couchdb_leap_mx_user')
  $couchdb_user     = $leap_mx['username']
  $couchdb_password = $leap_mx['password']

  $couchdb_host     = 'localhost'
  $couchdb_port     = '4096'

  $sources          = hiera('sources')

  include soledad::common
  include site_apt::preferences::twisted

  #
  # USER AND GROUP
  #

  group { 'leap-mx':
    ensure    => present,
    allowdupe => false;
  }

  user { 'leap-mx':
    ensure    => present,
    allowdupe => false,
    gid       => 'leap-mx',
    home      => '/etc/leap',
    require   => Group['leap-mx'];
  }

  #
  # LEAP-MX CONFIG
  #

  file { '/etc/leap/mx.conf':
    content => template('leap_mx/mx.conf.erb'),
    owner   => 'leap-mx',
    group   => 'leap-mx',
    mode    => '0600',
    notify  => Service['leap-mx'];
  }

  file { '/etc/default/leap_mx':
    content => 'LOGFILE=/var/log/leap/mx.log',
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
    notify  => Service['leap-mx'];
  }

  #
  # LEAP-MX CODE AND DEPENDENCIES
  #

  package {
    $sources['leap-mx']['package']:
      ensure  => $sources['leap-mx']['revision'],
      require => [
        Class['site_apt::preferences::twisted'],
        Class['site_apt::leap_repo'] ];

    'leap-keymanager':
      ensure => latest;
  }

  #
  # LEAP-MX DAEMON
  #

  service { 'leap-mx':
    ensure     => running,
    enable     => true,
    hasstatus  => true,
    hasrestart => true,
    require    => [ Package['leap-mx'] ];
  }

  augeas {
    "logrotate_mx":
      context => "/files/etc/logrotate.d/leap-mx/rule",
      changes => [
        "set file /var/log/leap/mx.log",
        'set rotate 5',
        'set schedule daily',
        'set compress compress',
        'set missingok missingok',
        'set ifempty notifempty',
        'set copytruncate copytruncate'
      ]
  }
}