Puppet Class: mattermost::config

Inherits:
mattermost
Defined in:
manifests/config.pp

Overview

See README.md.



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

class mattermost::config inherits mattermost {
  $override_options = $mattermost::override_options
  $conf = $mattermost::conf
  $purge_conf = $mattermost::purge_conf
  $override_env_options = $mattermost::override_env_options
  $env_conf = $mattermost::env_conf
  $purge_env_conf = $mattermost::purge_env_conf
  $dir = regsubst(
    $mattermost::dir,
    '__VERSION__',
    $mattermost::version
  )
  $source_conf = "${dir}/config/config.json"
  if $purge_conf {
    file { $conf:
      content => '{}',
      owner   => $mattermost::user,
      group   => $mattermost::group,
      mode    => '0640',
      replace => true,
    }
  } else {
    if $mattermost::install_from_pkg {
      file { $conf:
        replace => false,
      }
    } else {
      file { $conf:
        source  => $source_conf,
        owner   => $mattermost::user,
        group   => $mattermost::group,
        mode    => '0640',
        replace => false,
      }
    }
  }
  mattermost_settings{ $conf:
    values  => $override_options,
    require => File[$conf],
  }
  if $mattermost::install_from_pkg {
    file { $env_conf:
      replace => false,
    }
  } else {
    file { $env_conf:
      ensure  => file,
      content => '',
      owner   => $mattermost::user,
      group   => $mattermost::group,
      mode    => '0640',
      replace => false,
    }
  }
  augeas{ $env_conf:
    changes => template('mattermost/env.augeas.erb'),
    lens    => 'Shellvars.lns',
    incl    => $env_conf,
    require => File[$env_conf],
  }
}