-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathinstall_test_cluster.pp
71 lines (65 loc) · 2.8 KB
/
install_test_cluster.pp
1
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
plan peadm_spec::install_test_cluster (
String[1] $architecture,
String $download_mode = 'direct',
Optional[String[1]] $version = undef,
Optional[String[1]] $pe_installer_source = undef,
Boolean $permit_unsafe_versions = false,
Enum['enable', 'disable'] $fips = 'disable'
) {
$t = get_targets('*')
wait_until_available($t)
parallelize($t) |$target| {
$fqdn = run_command('hostname -f', $target)
$target.set_var('certname', $fqdn.first['stdout'].chomp)
}
if $fips == 'enable' {
run_command('/bin/fips-mode-setup --enable', $t)
run_plan('reboot', $t)
$fips_status = run_command('/bin/fips-mode-setup --check', $t)
$fips_status.each |$status| {
out::message("${status.target.name}: ${status.value['stdout']}")
}
}
$common_params = {
console_password => 'puppetlabs',
download_mode => $download_mode,
version => $version,
pe_installer_source => $pe_installer_source,
permit_unsafe_versions => $permit_unsafe_versions,
}
$arch_params =
case $architecture {
'standard': { {
primary_host => $t.filter |$n| { $n.vars['role'] == 'primary' },
} }
'standard-with-dr': { {
primary_host => $t.filter |$n| { $n.vars['role'] == 'primary' },
replica_host => $t.filter |$n| { $n.vars['role'] == 'replica' },
} }
'large': { {
primary_host => $t.filter |$n| { $n.vars['role'] == 'primary' },
compiler_hosts => $t.filter |$n| { $n.vars['role'] == 'compiler' },
} }
'large-with-dr': { {
primary_host => $t.filter |$n| { $n.vars['role'] == 'primary' },
replica_host => $t.filter |$n| { $n.vars['role'] == 'replica' },
compiler_hosts => $t.filter |$n| { $n.vars['role'] == 'compiler' },
} }
'extra-large': { {
primary_host => $t.filter |$n| { $n.vars['role'] == 'primary' },
primary_postgresql_host => $t.filter |$n| { $n.vars['role'] == 'primary-pdb-postgresql' },
compiler_hosts => $t.filter |$n| { $n.vars['role'] == 'compiler' },
} }
'extra-large-with-dr': { {
primary_host => $t.filter |$n| { $n.vars['role'] == 'primary' },
primary_postgresql_host => $t.filter |$n| { $n.vars['role'] == 'primary-pdb-postgresql' },
replica_host => $t.filter |$n| { $n.vars['role'] == 'replica' },
replica_postgresql_host => $t.filter |$n| { $n.vars['role'] == 'replica-pdb-postgresql' },
compiler_hosts => $t.filter |$n| { $n.vars['role'] == 'compiler' },
} }
default: { fail('Invalid architecture!') }
}
$install_result =
run_plan('peadm::install', $arch_params + $common_params)
return($install_result)
}