summaryrefslogtreecommitdiff
path: root/manifests/network.pp
blob: 23381e0655a9a926c52b6b829d58ace6f27d9562 (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
define henks_ircservices::network (
  String $run_user = "irc-services-${name}",
  String $network_name = $name,
) {
  $service_base = "/etc/s6-services/irc-services-${network_name}/"

  user {
    $run_user:
      ensure     => present,
      groups     => [ 'ssl-cert', ],
      password   => '!',
      managehome => true,
    ;
  }

  file {
    $service_base:
      ensure => directory,
    ;
    "${service_base}/run":
      ensure  => present,
      content => epp(
        'henks_ircservices/etc/s6-services/irc-services/run.epp',
        {
          'network_name' => $network_name,
          'run_user'     => $run_user,
        },
      ),
      mode    => '0755',
    ;
    "${service_base}/timeout-kill":
      ensure  => present,
      content => '0',
    ;
    "${service_base}/log/":
      ensure => directory,
    ;
    "${service_base}/log/run":
      ensure  => present,
      content => epp(
        'henks_ircservices/etc/s6-services/irc-services/log/run.epp',
        {
          'network_name' => $network_name,
        },
      ),
      mode    => '0755',
    ;
    "/var/log/s6/irc-services-${network_name}/":
      ensure => directory,
      mode   => '0700',
    ;
    "/var/log/s6/irc-services-${network_name}/logs/":
      ensure => directory,
      mode   => '0700',
    ;
  }

  service {
    "irc-services-${network_name}":
      ensure   => running,
      enable   => true,
      provider => 's6',
    ;
  }
}