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
|
# File 'plans/install/create_hiera_config.pp', line 9
plan cd4peadm::install::create_hiera_config(
String $hiera_config_file_path = 'hiera.yaml',
String $hiera_data_file_path = 'data/common.yaml',
String $pkcs7_private_key_path = 'keys/private_key.pkcs7.pem',
String $pkcs7_public_key_path = 'keys/public_key.pkcs7.pem',
) {
out::message('Checking if hiera.yaml exists for Bolt project')
$hiera_absolute_path = file::join(cd4peadm::bolt_project_dir(), $hiera_config_file_path)
if file::exists($hiera_absolute_path) {
out::message("Found existing configuration at '${hiera_absolute_path}', skipping creation")
} else {
$hiera_config = {
'version' => 5,
'defaults' => {
'datadir' => cd4peadm::file_dirname($hiera_data_file_path),
'data_hash' => 'yaml_data',
},
'hierarchy' => [{
'name' => 'common',
'lookup_key' => 'eyaml_lookup_key',
'options' => {
'pkcs7_private_key' => $pkcs7_private_key_path,
'pkcs7_public_key' => $pkcs7_public_key_path,
},
'paths' => [
'common.yaml',
],
}],
}
$hiera_config_path = cd4peadm::save_yaml_file($hiera_config, $hiera_config_file_path)
out::message("Saved Hiera config file to ${hiera_config_path}")
}
}
|