Puppet Class: supervisord::config

Defined in:
manifests/config.pp

Overview

This class is called from supervisord for service config.



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

class supervisord::config {
  assert_private('supervisord::config is a private class')

  $default_inisettings = {
    'unix_http_server'        =>
      { 'file' => "${::supervisord::supervisord_rundir}/supervisor.sock" },
    'supervisord'             =>
      {
        'logfile'          => "${::supervisord::supervisord_logdir}/supervisord.log",
        'logfile_maxbytes' => '50MB',
        'logfile_backups'  => '10',
        'loglevel'         => 'info',
        'pidfile'          => "${::supervisord::supervisord_rundir}/supervisord.pid",
        'nodaemon'         => 'false',
        'minfds'           => '1024',
        'minprocs'         => '200',
      },
    'rpcinterface:supervisor' =>
      {
        'supervisor.rpcinterface_factory' => 'supervisor.rpcinterface:make_main_rpcinterface',
      },
    'supervisorctl'           =>
      {
        'serverurl' => "unix://${::supervisord::supervisord_rundir}/supervisor.sock",
      },
    'include'                 =>
      {
        'files' => "${::supervisord::supervisord_confdir}/conf.d/*.conf",
      },
  }

  if $::supervisord::supervisord_ini_present {
    $_ini_present = deep_merge( $default_inisettings, $::supervisord::supervisord_ini_present)
  }
  else {
    $_ini_present = $default_inisettings
  }

  file { "${::supervisord::supervisord_confdir}/${::supervisord::supervisord_conffile}":
    ensure => 'present',
    owner  => 'root',
    group  => 'root',
    mode   => '0644',
  }

  $_ini_present.each |String $_section, Hash $_settings| {
    $_settings.each |String $_setting, String $_value| {
      ini_setting { "${_section} ${_setting}":
        ensure  => present,
        path    => "${::supervisord::supervisord_confdir}/${::supervisord::supervisord_conffile}",
        section => $_section,
        setting => $_setting,
        value   => $_value,
      }
    }
  }

  if $::supervisord::supervisord_ini_absent {
    $_ini_absent = $::supervisord::supervisord_ini_absent
    $_ini_absent.each |String $_absent_section, Hash $_absent_settings| {
      $_absent_settings.each |String $_absent_setting, String $_absent_value| {
        ini_setting { "${_absent_section} ${_absent_setting}":
          ensure  => absent,
          path    => "${::supervisord::supervisord_confdir}/${::supervisord::supervisord_conffile}",
          section => $_absent_section,
          setting => $_absent_setting,
          value   => $_absent_value,
        }
      }
    }
  }

  if $::supervisord::manage_systemd_unit {
    include ::systemd::systemctl::daemon_reload
    $_after      = $::supervisord::supervisord_systemd_after
    $_binpath    = $::supervisord::supervisord_binpath
    $_confdir    = $::supervisord::supervisord_confdir
    $_conffile   = $::supervisord::supervisord_conffile
    $_ctlpath    = $::supervisord::supervisord_ctlpath
    $_killmode   = $::supervisord::supervisord_systemd_killmode
    $_restart    = $::supervisord::supervisord_systemd_restart
    $_restartsec = $::supervisord::supervisord_systemd_restartsec
    $_type       = $::supervisord::supervisord_systemd_type
    file { '/etc/systemd/system/supervisord.service':
      ensure  => file,
      owner   => 'root',
      group   => 'root',
      mode    => '0644',
      content => template($::supervisord::supervisord_systemd_template),
    } ~> Class['systemd::systemctl::daemon_reload']
  }
}