-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathprovision_test_cluster.pp
99 lines (96 loc) · 3.2 KB
/
provision_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
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
plan peadm_spec::provision_test_cluster (
$provider,
$architecture,
$image,
) {
# Read and parse metadata.json
$metadata = parsejson(file('./.modules/peadm/metadata.json'))
out::message("peadm module metadata: ${metadata}")
# Get the version value
$module_version = $metadata['version']
out::message("peadm module version: ${module_version}")
$nodes =
case $architecture {
'standard': {
['primary']
}
'standard-with-dr': {
['primary', 'replica']
}
'standard-and-spare-replica': {
['primary', 'spare-replica']
}
'standard-with-dr-and-spare-replica': {
['primary', 'replica', 'spare-replica']
}
'large': {
['primary', 'compiler']
}
'large-with-two-compilers': {
['primary', 'compiler', 'compiler']
}
'large-with-dr': {
['primary', 'compiler', 'replica', 'compiler']
}
'large-and-spare-replica': {
['primary', 'compiler', 'compiler', 'spare-replica']
}
'large-with-dr-and-spare-replica': {
['primary', 'compiler', 'replica', 'compiler', 'spare-replica']
}
'extra-large': {
['primary', 'primary-pdb-postgresql', 'compiler']
}
'extra-large-with-dr': {
['primary', 'primary-pdb-postgresql', 'compiler', 'replica', 'replica-pdb-postgresql', 'compiler']
}
'standard-with-extra-compiler': {
['primary', 'unconfigured-compiler']
}
'large-with-extra-compiler': {
['primary', 'compiler', 'unconfigured-compiler']
}
'extra-large-with-extra-compiler': {
['primary', 'primary-pdb-postgresql', 'compiler', 'unconfigured-compiler']
}
'extra-large-and-spare-replica': {
['primary', 'primary-pdb-postgresql', 'compiler', 'compiler', 'spare-replica']
}
'extra-large-with-dr-and-spare-replica': {
['primary', 'primary-pdb-postgresql', 'compiler',
'replica', 'replica-pdb-postgresql', 'compiler', 'spare-replica']
}
'standard-migration': {
['primary', 'new-primary']
}
'standard-with-dr-migration': {
['primary', 'replica', 'new-primary', 'new-replica']
}
'large-migration': {
['primary', 'compiler', 'new-primary']
}
'large-with-dr-migration': {
['primary', 'compiler', 'replica', 'compiler', 'new-primary', 'new-replica']
}
'extra-large-migration': {
['primary', 'primary-pdb-postgresql', 'compiler', 'new-primary', 'new-primary-pdb-postgresql']
}
'extra-large-with-dr-migration': {
['primary', 'primary-pdb-postgresql', 'compiler', 'replica', 'replica-pdb-postgresql', 'compiler', 'new-primary', 'new-replica', 'new-primary-pdb-postgresql', 'new-replica-pdb-postgresql']
}
default: {
fail_plan("Unknown architecture: ${architecture}")
}
}
$provision_results =
# This SHOULD be `parallelize() || {}`. However, provision::* is entirely
# side-effect based, and not at all parallel-safe.
$nodes.each |$role| {
run_task("provision::${provider}", 'localhost',
action => 'provision',
platform => $image,
vars => "role: ${role}"
)
}
return($provision_results)
}