Puppet Class: slurm::slurmctld::service

Defined in:
manifests/slurmctld/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
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'manifests/slurmctld/service.pp', line 2

class slurm::slurmctld::service {

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

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

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

  if $slurm::slurmctld_restart_on_failure {
    $slurmctld_systemd_restart = 'present'
  } else {
    $slurmctld_systemd_restart = 'absent'
  }

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

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

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

  service { 'slurmctld':
    ensure     => $slurm::slurmctld_service_ensure,
    enable     => $slurm::slurmctld_service_enable,
    hasstatus  => true,
    hasrestart => true,
  }

  exec { 'scontrol reconfig':
    path        => '/usr/bin:/bin:/usr/sbin:/sbin',
    refreshonly => true,
  }

  if $slurm::enable_configless {
    Service['slurmctld'] ~> Exec['scontrol reconfig']
  } else {
    Service['slurmctld'] -> Exec['scontrol reconfig']
  }

  if $slurm::restart_services {
    slurmctld_conn_validator { 'puppet':
      ensure  => 'present',
      timeout => $slurm::slurmctld_conn_validator_timeout,
      before  => Exec['scontrol reconfig'],
      require => Service['slurmctld'],
    }
  }
}