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
|
# File 'manifests/common/install/source.pp', line 2
class slurm::common::install::source {
if $slurm::osfamily == 'RedHat' {
include epel
$package_require = Yumrepo['epel']
} else {
$package_require = undef
}
ensure_packages($slurm::source_dependencies)
$slurm::source_dependencies.each |$package| {
if $package_require {
$package_require -> Package[$package]
}
Package[$package] -> Archive[$slurm::src_file]
}
if ($facts['os']['family'] == 'Debian') or ($facts['os']['family'] == 'RedHat' and versioncmp($facts['os']['release']['major'], '8') >= 0) {
if $slurm::source_install_manage_alternatives {
if $facts['os']['family'] == 'Debian' {
alternative_entry { '/usr/bin/python3':
ensure => 'present',
altlink => '/usr/bin/python',
altname => 'python',
priority => 10,
require => Package['python3'],
before => Alternatives['python'],
}
}
alternatives { 'python':
path => '/usr/bin/python3',
require => Package['python3'],
before => Exec['install-slurm'],
}
}
}
archive { $slurm::src_file:
source => "https://download.schedmd.com/slurm/slurm-${slurm::version}.tar.bz2",
extract => true,
extract_path => '/usr/local/src',
creates => $slurm::src_dir,
cleanup => true,
user => 'root',
group => 'root',
notify => Exec['install-slurm'],
}
$base_configure_flags = join([
"--prefix=${slurm::install_prefix}",
"--libdir=${slurm::install_prefix}/lib64",
"--sysconfdir=${slurm::conf_dir}",
'--enable-slurmrestd',
], ' ')
$configure_flags = join($slurm::configure_flags, ' ')
$configure_command = "./configure ${base_configure_flags} ${configure_flags}"
file { "${slurm::src_dir}/puppet-install.sh":
ensure => 'file',
owner => 'root',
group => 'root',
mode => '0755',
content => join([
'#!/bin/bash',
"cd ${slurm::src_dir}",
$configure_command,
'[ $? -ne 0 ] && { rm -f $0; exit 1; }',
"make -j${facts['processors']['count']}",
'[ $? -ne 0 ] && { rm -f $0; exit 1; }',
'make install',
'[ $? -ne 0 ] && { rm -f $0; exit 1; }',
'exit 0',
'',
], "\n"),
notify => Exec['install-slurm'],
require => Archive[$slurm::src_file],
}
if $slurm::install_prefix != '/usr' {
file { '/etc/ld.so.conf.d/slurm.conf':
ensure => 'file',
owner => 'root',
group => 'root',
mode => '0644',
content => "${slurm::install_prefix}/lib64\n",
require => Exec['install-slurm'],
notify => Exec['ldconfig-slurm'],
}
}
exec { 'install-slurm':
path => "${slurm::src_dir}:/usr/bin:/bin:/usr/sbin:/sbin",
command => "${slurm::src_dir}/puppet-install.sh",
cwd => $slurm::src_dir,
refreshonly => true,
}
~> exec { 'ldconfig-slurm':
path => '/usr/bin:/bin:/usr/sbin:/sbin',
command => 'ldconfig',
refreshonly => true,
}
}
|