Skip to content

Commit 577150c

Browse files
authored
Merge pull request #44 from tkishel/hiera_classifier_data
configure classifier data in global hiera.yaml
2 parents 5e7974b + a5d3cad commit 577150c

File tree

3 files changed

+51
-4
lines changed

3 files changed

+51
-4
lines changed

plans/action/configure.pp

+23-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# @summary Configure first-time classification and HA setup
22
#
33
plan peadm::action::configure (
4-
# Large
4+
# Standard
55
Peadm::SingleTargetSpec $master_host,
6-
Optional[TargetSpec] $compiler_hosts = undef,
76
Optional[Peadm::SingleTargetSpec] $master_replica_host = undef,
87

8+
# Large
9+
Optional[TargetSpec] $compiler_hosts = undef,
10+
911
# Extra Large
1012
Optional[Peadm::SingleTargetSpec] $puppetdb_database_host = undef,
1113
Optional[Peadm::SingleTargetSpec] $puppetdb_database_replica_host = undef,
@@ -37,8 +39,25 @@
3739
$compiler_hosts,
3840
)
3941

40-
# Set up the console node groups to configure the various hosts in their
41-
# roles
42+
# Define the global hiera.yaml file on the Master; and syncronize to any Replica and Compilers.
43+
# This enables Data in the Classifier/Console, which is used/required by this architecture.
44+
# Necessary, for example, when promoting the Replica due to PE-18400 (and others).
45+
$global_hiera_yaml = run_task('peadm::read_file', $master_target,
46+
path => '/etc/puppetlabs/puppet/hiera.yaml',
47+
).first['content']
48+
49+
run_task('peadm::mkdir_p_file', peadm::flatten_compact([
50+
$master_replica_target,
51+
$compiler_targets,
52+
)],
53+
path => '/etc/puppetlabs/puppet/hiera.yaml',
54+
owner => 'root',
55+
group => 'root',
56+
mode => '0644',
57+
content => $global_hiera_yaml,
58+
)
59+
60+
# Set up the console node groups to configure the various hosts in their roles
4261

4362
# Pending resolution of Bolt GH-1244, Target objects and their methods are
4463
# not accessible inside apply() blocks. Work around the limitation for now

tasks/read_file.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"description": "Read the contents of a file",
3+
"parameters": {
4+
"path": {
5+
"type": "String",
6+
"description": "Path to the file to read"
7+
}
8+
},
9+
"input_method": "environment"
10+
}

tasks/read_file.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
main() {
4+
cat "$PT_path"
5+
}
6+
7+
outfile=$(mktemp)
8+
main "$@" >"$outfile" 2>&1
9+
exit_code=$?
10+
11+
cat <<EOS
12+
{
13+
"content": $(python -c "import json; print json.dumps(open('$outfile','r').read())")
14+
}
15+
EOS
16+
17+
rm "$outfile"
18+
exit $exit_code

0 commit comments

Comments
 (0)