Puppet Class: slurm::slurmdbd::service

Defined in:
manifests/slurmdbd/service.pp

Overview



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

class slurm::slurmdbd::service {

  file { "${slurm::env_dir}/slurmdbd":
    ensure  => 'file',
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
    content => template('slurm/sysconfig/slurmdbd.erb'),
    notify  => Service['slurmdbd'],
  }

  if ! empty($slurm::slurmdbd_service_limits) {
    systemd::service_limits { 'slurmdbd.service':
      limits          => $slurm::sslurmdbd_service_limits,
      restart_service => false,
      notify          => Service['slurmdbd'],
    }
  }

  if $slurm::slurmdbd_archive_dir_systemd {
    $systemd_mounts = 'present'
  } else {
    $systemd_mounts = 'absent'
  }
  systemd::dropin_file { 'slurmdbd-mounts.conf':
    ensure         => $systemd_mounts,
    unit           => 'slurmctld.service',
    content        => join(delete_undef_values([
      '# File managed by Puppet',
      '[Unit]',
      $slurm::slurmdbd_archive_dir_systemd,
    ]), "\n"),
    notify_service => false,
    notify         => Service['slurmdbd'],
  }

  if $slurm::slurmdbd_restart_on_failure {
    $slurmdbd_systemd_restart = 'present'
  } else {
    $slurmdbd_systemd_restart = 'absent'
  }

  systemd::dropin_file { 'slurmdbd-restart.conf':
    ensure         => $slurmdbd_systemd_restart,
    unit           => 'slurmdbd.service',
    content        => join([
      '# File managed by Puppet',
      '[Service]',
      'Restart=on-failure',
    ], "\n"),
    notify_service => false,
    notify         => Service['slurmdbd'],
  }

  systemd::dropin_file { 'slurmdbd-logging.conf':
    ensure         => $slurm::logging_systemd_override,
    unit           => 'slurmdbd.service',
    content        => join([
      '# File managed by Puppet',
      '[Service]',
      'StandardOutput=null',
      'StandardError=null',
    ], "\n"),
    notify_service => false,
    notify         => Service['slurmdbd'],
  }

  if $slurm::install_method == 'source' {
    systemd::unit_file { 'slurmdbd.service':
      source  => "file:///${slurm::src_dir}/etc/slurmdbd.service",
      require => Exec['install-slurm'],
      notify  => Service['slurmdbd'],
    }
  }

  service { 'slurmdbd':
    ensure     => $slurm::slurmdbd_service_ensure,
    enable     => $slurm::slurmdbd_service_enable,
    hasstatus  => true,
    hasrestart => true,
  }

  exec { 'slurmdbd reload':
    path        => '/usr/bin:/bin:/usr/sbin:/sbin',
    command     => 'systemctl reload slurmdbd',
    refreshonly => true,
    require     => Service['slurmdbd'],
  }
}