Skip to content

Commit cec9af4

Browse files
committed
Iterate on correctness of node groups for HA
Trying to get everything configured correctly without touching the groups managed by the `puppet infra` commands
1 parent 0037b2b commit cec9af4

File tree

4 files changed

+53
-25
lines changed

4 files changed

+53
-25
lines changed

Diff for: plans/configure.pp

+26-17
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
String[1] $stagingdir = '/tmp',
1919
) {
2020

21+
# Retrieve and deploy a couple of modules from the Forge so that they can be
22+
# used for ensuring some configuration.
2123
$nm_module_tarball = 'WhatsARanjit-node_manager-0.7.1.tar.gz'
2224
pe_xl::retrieve_and_upload(
2325
"https://forge.puppet.com/v3/files/${nm_module_tarball}",
@@ -38,6 +40,8 @@
3840
run_command("/opt/puppetlabs/bin/puppet module install /tmp/${pexl_module_tarball}", $primary_master_host)
3941
run_command('chown -R pe-puppet:pe-puppet /etc/puppetlabs/code', $primary_master_host)
4042

43+
# Set up the console node groups to configure the various hosts in their
44+
# roles
4145
run_task('pe_xl::configure_node_groups', $primary_master_host,
4246
primary_master_host => $primary_master_host,
4347
primary_master_replica_host => $primary_master_replica_host,
@@ -46,37 +50,42 @@
4650
compile_master_pool_address => $compile_master_pool_address,
4751
)
4852

53+
# Run Puppet in no-op on the compile masters so that their status in PuppetDB
54+
# is updated and they can be identified by the puppet_enterprise module as
55+
# CMs
56+
run_task('pe_xl::puppet_runonce', $compile_master_hosts,
57+
noop => true,
58+
)
59+
60+
# Run Puppet on the PuppetDB Database hosts to update their auth
61+
# configuration to allow the compile masters to connect
4962
run_task('pe_xl::puppet_runonce', [
50-
$primary_master_host,
5163
$puppetdb_database_host,
52-
$primary_master_replica_host,
5364
$puppetdb_database_replica_host,
5465
])
5566

56-
# Run the PE Replica Provision
57-
run_task('pe_xl::provision_replica', $primary_master_host,
58-
primary_master_replica => $primary_master_replica_host,
59-
)
60-
67+
# Run Puppet in normal mode on compile master hosts to finish configuration
6168
run_task('pe_xl::puppet_runonce', [
6269
$primary_master_host,
63-
$primary_master_replica_host,
70+
$compile_master_hosts,
6471
])
6572

66-
run_task(pe_xl::configure_replica_db_node_group, $primary_master_host,
67-
puppetdb_database_replica_host => $puppetdb_database_replica_host,
73+
# Run the PE Replica Provision
74+
run_task('pe_xl::provision_replica', $primary_master_host,
75+
primary_master_replica => $primary_master_replica_host,
6876
)
69-
if $compile_master_hosts {
70-
run_task('pe_xl::puppet_runonce', $compile_master_hosts)
71-
}
7277

78+
#run_task('pe_xl::puppet_runonce', [
79+
# $primary_master_host,
80+
# $primary_master_replica_host,
81+
#])
82+
83+
#run_task(pe_xl::configure_replica_db_node_group, $primary_master_host,
84+
# puppetdb_database_replica_host => $puppetdb_database_replica_host,
85+
#)
7386
if $load_balancer_host {
7487
run_task('pe_xl::puppet_runonce', $load_balancer_host)
7588
}
7689

77-
if $compile_master_hosts {
78-
run_task('pe_xl::puppet_runonce', $compile_master_hosts)
79-
}
80-
8190
return('Configuration of Puppet Enterprise with replica succeeded.')
8291
}

Diff for: tasks/configure_node_groups.pp

+13-6
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ function param($name) { inline_template("<%= ENV['PT_${name}'] %>") }
3737
['=', ['trusted', 'extensions', 'pp_cluster'], 'A'],
3838
],
3939
classes => {
40-
'puppet_enterprise::profile::puppetdb' => { }
41-
},
42-
data => {
43-
'puppet_enterprise::profile::primary_master_replica' => {'database_host_puppetdb' => $puppetdb_database_host }
40+
'puppet_enterprise::profile::puppetdb' => {
41+
'puppetdb_host' => ['${clientcert}', $primary_master_host],
42+
'puppetdb_port' => [8081],
43+
}
4444
},
4545
}
4646

@@ -52,9 +52,16 @@ function param($name) { inline_template("<%= ENV['PT_${name}'] %>") }
5252
['=', ['trusted', 'extensions', 'pp_cluster'], 'B'],
5353
],
5454
classes => {
55-
'puppet_enterprise::profile::puppetdb' => { }
55+
'puppet_enterprise::profile::puppetdb' => {
56+
'puppetdb_host' => ['${clientcert}', $primary_master_replica_host],
57+
'puppetdb_port' => [8081],
58+
}
5659
},
57-
data => {
60+
}
61+
62+
node_group { 'PE HA Master':
63+
ensure => present,
64+
data => {
5865
'puppet_enterprise::profile::primary_master_replica' => {'database_host_puppetdb' => $puppetdb_database_replica_host }
5966
},
6067
}

Diff for: tasks/puppet_runonce.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
{
22
"description": "Run the Puppet agent one time",
3-
"parameters": { },
3+
"parameters": {
4+
"noop": {
5+
"type": "Optional[Boolean]",
6+
"description": "If true, run Puppet in no-op mode"
7+
}
8+
},
49
"input_method": "environment",
510
"implementations": [
611
{"name": "puppet_runonce.sh"}

Diff for: tasks/puppet_runonce.sh

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
#!/bin/bash
22

3+
unset NOOP_FLAG
4+
5+
if [ "$PT_noop" = "true" ]; then
6+
NOOP_FLAG="--noop"
7+
fi
8+
39
/opt/puppetlabs/bin/puppet agent \
410
--onetime \
511
--verbose \
612
--no-daemonize \
713
--no-usecacheonfailure \
814
--no-splay \
9-
--no-use_cached_catalog
15+
--no-use_cached_catalog \
16+
$NOOP_FLAG

0 commit comments

Comments
 (0)