Skip to content

Commit 127bc3e

Browse files
committed
Switch to using apply blocks for node_manager
It took awhile to figure out how to do this, but I think this latest iteration actually works.
1 parent dee5e8d commit 127bc3e

File tree

6 files changed

+36
-299
lines changed

6 files changed

+36
-299
lines changed

Diff for: manifests/setup/node_manager.pp

+15-12
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,21 @@
6161
variables => { 'pe_master' => true },
6262
}
6363

64-
# This class has to be included here because puppet_enterprise is declared
65-
# in the console with parameters. It is therefore not possible to include
66-
# puppet_enterprise::profile::database in code without causing a conflict.
67-
node_group { 'PE Database':
68-
ensure => present,
69-
parent => 'PE Infrastructure',
70-
environment => 'production',
71-
override_environment => false,
72-
rule => ['and', ['=', ['trusted', 'extensions', 'pp_role'], 'pe_xl::puppetdb_database']],
73-
classes => {
74-
'puppet_enterprise::profile::database' => { },
75-
},
64+
# Create the database group if a database host is external
65+
if ($puppetdb_database_host != $master_host) {
66+
# This class has to be included here because puppet_enterprise is declared
67+
# in the console with parameters. It is therefore not possible to include
68+
# puppet_enterprise::profile::database in code without causing a conflict.
69+
node_group { 'PE Database':
70+
ensure => present,
71+
parent => 'PE Infrastructure',
72+
environment => 'production',
73+
override_environment => false,
74+
rule => ['and', ['=', ['trusted', 'extensions', 'pp_role'], 'pe_xl::puppetdb_database']],
75+
classes => {
76+
'puppet_enterprise::profile::database' => { },
77+
},
78+
}
7679
}
7780

7881
# Create data-only groups to store PuppetDB PostgreSQL database configuration

Diff for: plans/test.pp

-33
This file was deleted.

Diff for: plans/unit/configure.pp

+21-20
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,29 @@
3737
$compiler_hosts,
3838
)
3939

40-
# Retrieve and deploy Puppet modules from the Forge so that they can be used
41-
# for ensuring some configuration (node groups)
42-
[ ['WhatsARanjit-node_manager', '0.7.1'],
43-
['puppetlabs-stdlib', '5.0.0'],
44-
].each |$tuple| {
45-
run_plan('pe_xl::util::install_module',
46-
nodes => $master_target,
47-
module => $tuple[0],
48-
version => $tuple[1],
49-
stagingdir => $stagingdir,
50-
)
51-
}
52-
5340
# Set up the console node groups to configure the various hosts in their
5441
# roles
55-
run_task('pe_xl::configure_node_groups', $master_target,
56-
master_host => $master_target.pe_xl::target_host(),
57-
master_replica_host => $master_replica_target.pe_xl::target_host(),
58-
puppetdb_database_host => $puppetdb_database_target.pe_xl::target_host(),
59-
puppetdb_database_replica_host => $puppetdb_database_replica_target.pe_xl::target_host(),
60-
compiler_pool_address => $compiler_pool_address,
61-
)
42+
apply($master_target) {
43+
# Necessary to give the sandboxed Puppet executor the configuration
44+
# necessary to connect to the classifier`
45+
file { 'node_manager.yaml':
46+
ensure => file,
47+
mode => '0644',
48+
path => Deferred('pe_xl::node_manager_yaml_location'),
49+
content => epp('pe_xl/node_manager.yaml.epp', {
50+
server => $servername,
51+
}),
52+
}
53+
54+
class { 'pe_xl::setup::node_manager':
55+
master_host => $master_target.pe_xl::target_host(),
56+
master_replica_host => $master_replica_target.pe_xl::target_host(),
57+
puppetdb_database_host => $puppetdb_database_target.pe_xl::target_host(),
58+
puppetdb_database_replica_host => $puppetdb_database_replica_target.pe_xl::target_host(),
59+
compiler_pool_address => $compiler_pool_address,
60+
require => File['node_manager.yaml'],
61+
}
62+
}
6263

6364
# Run Puppet in no-op on the compilers so that their status in PuppetDB
6465
# is updated and they can be identified by the puppet_enterprise module as

Diff for: plans/util/install_module.pp

-29
This file was deleted.

Diff for: tasks/configure_node_groups.json

-29
This file was deleted.

Diff for: tasks/configure_node_groups.sh

-176
This file was deleted.

0 commit comments

Comments
 (0)