Skip to content

Commit

Permalink
Merge pull request #161 from timidri/SOLARCH-486-change-puppetdb_data…
Browse files Browse the repository at this point in the history
…base_host-parameter-s-to-pe_p

Global rename of primary/replica and postgresql parameters
  • Loading branch information
reidmv authored Jun 17, 2021
2 parents ee33995 + 4a5a688 commit 0b8af72
Show file tree
Hide file tree
Showing 35 changed files with 217 additions and 207 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/manual-smoke-test-with-debugging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,15 @@ jobs:
echo STEP_START=$(date +%s) >> $GITHUB_ENV
echo ::endgroup::
- name: 'Wait as long as the file ${HOME}/pause file is present'
if: ${{ always() }}
run: |
while [ -f "${HOME}/pause" ] ; do
echo "${HOME}/pause present, sleeping for 60 seconds..."
sleep 60
done
echo "${HOME}/pause absent, continuing workflow."
- name: 'Tear down test cluster'
if: ${{ always() }}
continue-on-error: true
Expand Down
2 changes: 1 addition & 1 deletion documentation/convert.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Prepare to run the plan against all servers in the PE infrastructure, using a pa
```json
{
"primary_host": "pe-xl-core-0.lab1.puppet.vm",
"primary_replica_host": "pe-xl-core-1.lab1.puppet.vm",
"replica_host": "pe-xl-core-1.lab1.puppet.vm",
"compiler_hosts": [
"pe-xl-compiler-0.lab1.puppet.vm",
"pe-xl-compiler-1.lab1.puppet.vm"
Expand Down
8 changes: 4 additions & 4 deletions documentation/provision.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ Example params.json Bolt parameters file (shown: Extra Large with DR):
```json
{
"primary_host": "pe-xl-core-0.lab1.puppet.vm",
"puppetdb_database_host": "pe-xl-core-1.lab1.puppet.vm",
"primary_replica_host": "pe-xl-core-2.lab1.puppet.vm",
"puppetdb_database_replica_host": "pe-xl-core-3.lab1.puppet.vm",
"primary_postgresql_host": "pe-xl-core-1.lab1.puppet.vm",
"replica_host": "pe-xl-core-2.lab1.puppet.vm",
"replica_postgresql_host": "pe-xl-core-3.lab1.puppet.vm",
"compiler_hosts": [
"pe-xl-compiler-0.lab1.puppet.vm",
"pe-xl-compiler-1.lab1.puppet.vm"
Expand Down Expand Up @@ -147,7 +147,7 @@ A parameters JSON file can then reference the target names, which will become th
```json
{
"primary_host": "pe-xl-core-0.lab1.puppet.vm",
"primary_replica_host": "pe-xl-core-1.lab1.puppet.vm",
"replica_host": "pe-xl-core-1.lab1.puppet.vm",

"console_password": "puppetlabs",
"dns_alt_names": [ "puppet", "puppet.lab1.puppet.vm" ],
Expand Down
6 changes: 3 additions & 3 deletions documentation/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ The following is an example parameters file for upgrading an Extra Large archite
{
"version": "2019.2.2",
"primary_host": "pe-master-09a40c-0.us-west1-a.c.reidmv-peadm.internal",
"puppetdb_database_host": "pe-psql-09a40c-0.us-west1-a.c.reidmv-peadm.internal",
"primary_replica_host": "pe-master-09a40c-1.us-west1-b.c.reidmv-peadm.internal",
"puppetdb_database_replica_host": "pe-psql-09a40c-1.us-west1-b.c.reidmv-peadm.internal",
"primary_postgresql_host": "pe-psql-09a40c-0.us-west1-a.c.reidmv-peadm.internal",
"replica_host": "pe-master-09a40c-1.us-west1-b.c.reidmv-peadm.internal",
"replica_postgresql_host": "pe-psql-09a40c-1.us-west1-b.c.reidmv-peadm.internal",
"compiler_hosts": [
"pe-compiler-09a40c-0.us-west1-a.c.reidmv-peadm.internal",
"pe-compiler-09a40c-1.us-west1-b.c.reidmv-peadm.internal",
Expand Down
6 changes: 3 additions & 3 deletions examples/provision/extra-large-ha.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"version": "2019.4.0",
"console_password": "puppetlabs",
"primary_host": "pe-master-1830cd-0.us-west1-a.c.reidmv-peadm.internal",
"primary_replica_host": "pe-master-1830cd-1.us-west1-b.c.reidmv-peadm.internal",
"puppetdb_database_host": "pe-psql-1830cd-0.us-west1-a.c.reidmv-peadm.internal",
"puppetdb_database_replica_host": "pe-psql-1830cd-1.us-west1-b.c.reidmv-peadm.internal",
"replica_host": "pe-master-1830cd-1.us-west1-b.c.reidmv-peadm.internal",
"primary_postgresql_host": "pe-psql-1830cd-0.us-west1-a.c.reidmv-peadm.internal",
"replica_postgresql_host": "pe-psql-1830cd-1.us-west1-b.c.reidmv-peadm.internal",
"compiler_pool_address": "puppet.pe-compiler-lb-1830cd.il4.us-west1.lb.reidmv-peadm.internal",
"compiler_hosts": [
"pe-compiler-1830cd-0.us-west1-a.c.reidmv-peadm.internal",
Expand Down
2 changes: 1 addition & 1 deletion examples/provision/extra-large.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"console_password": "puppetlabs",
"primary_host": "pe-master-1830cd-0.us-west1-a.c.reidmv-peadm.internal",

"puppetdb_database_host": "pe-psql-1830cd-0.us-west1-a.c.reidmv-peadm.internal",
"primary_postgresql_host": "pe-psql-1830cd-0.us-west1-a.c.reidmv-peadm.internal",

"compiler_pool_address": "puppet.pe-compiler-lb-1830cd.il4.us-west1.lb.reidmv-peadm.internal",
"compiler_hosts": [
Expand Down
2 changes: 1 addition & 1 deletion examples/provision/large-ha.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version": "2019.4.0",
"console_password": "puppetlabs",
"primary_host": "pe-master-1830cd-0.us-west1-a.c.reidmv-peadm.internal",
"primary_replica_host": "pe-master-1830cd-1.us-west1-b.c.reidmv-peadm.internal",
"replica_host": "pe-master-1830cd-1.us-west1-b.c.reidmv-peadm.internal",


"compiler_pool_address": "puppet.pe-compiler-lb-1830cd.il4.us-west1.lb.reidmv-peadm.internal",
Expand Down
2 changes: 1 addition & 1 deletion examples/provision/standard-ha.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version": "2019.4.0",
"console_password": "puppetlabs",
"primary_host": "pe-master-1830cd-0.us-west1-a.c.reidmv-peadm.internal",
"primary_replica_host": "pe-master-1830cd-1.us-west1-b.c.reidmv-peadm.internal",
"replica_host": "pe-master-1830cd-1.us-west1-b.c.reidmv-peadm.internal",


"compiler_pool_address": "puppet.pe-compiler-lb-1830cd.il4.us-west1.lb.reidmv-peadm.internal",
Expand Down
18 changes: 9 additions & 9 deletions functions/assert_supported_architecture.pp
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
function peadm::assert_supported_architecture (
TargetSpec $primary_host,
Variant[TargetSpec, Undef] $primary_replica_host = undef,
Variant[TargetSpec, Undef] $puppetdb_database_host = undef,
Variant[TargetSpec, Undef] $puppetdb_database_replica_host = undef,
Variant[TargetSpec, Undef] $replica_host = undef,
Variant[TargetSpec, Undef] $primary_postgresql_host = undef,
Variant[TargetSpec, Undef] $replica_postgresql_host = undef,
Variant[TargetSpec, Undef] $compiler_hosts = undef,
) >> Hash {
$result = case [
!!($primary_host),
!!($primary_replica_host),
!!($puppetdb_database_host),
!!($puppetdb_database_replica_host),
!!($replica_host),
!!($primary_postgresql_host),
!!($replica_postgresql_host),
] {
[true, false, false, false]: { # Standard or Large, no DR
({ 'disaster-recovery' => false, 'architecture' => $compiler_hosts ? {
Expand All @@ -33,13 +33,13 @@ function peadm::assert_supported_architecture (
out::message(inline_epp(@(HEREDOC)))
Invalid architecture! Recieved:
- primary
<% if $primary_replica_host { -%>
<% if $replica_host { -%>
- primary-replica
<% } -%>
<% if $puppetdb_database_host { -%>
<% if $primary_postgresql_host { -%>
- pdb-database
<% } -%>
<% if $puppetdb_database_replica_host { -%>
<% if $replica_postgresql_host { -%>
- pdb-database-replica
<% } -%>
<% if $compiler_hosts { -%>
Expand Down
22 changes: 11 additions & 11 deletions manifests/setup/node_manager.pp
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@
String[1] $primary_host,

# High Availability
Optional[String[1]] $primary_replica_host = undef,
Optional[String[1]] $replica_host = undef,

# Common
Optional[String[1]] $compiler_pool_address = undef,
Optional[String[1]] $internal_compiler_a_pool_address = $primary_host,
Optional[String[1]] $internal_compiler_b_pool_address = $primary_replica_host,
Optional[String[1]] $internal_compiler_b_pool_address = $replica_host,

# For the next two parameters, the default values are appropriate when
# deploying Standard or Large architectures. These values only need to be
# specified differently when deploying an Extra Large architecture.

# Specify when using Extra Large
String[1] $puppetdb_database_host = $primary_host,
String[1] $primary_postgresql_host = $primary_host,

# Specify when using Extra Large AND High Availability
Optional[String[1]] $puppetdb_database_replica_host = $primary_replica_host,
Optional[String[1]] $replica_postgresql_host = $replica_host,
) {

# Preserve existing user data and classes values. We only need to make sure
Expand Down Expand Up @@ -105,10 +105,10 @@
],
data => {
'puppet_enterprise::profile::primary_master_replica' => {
'database_host_puppetdb' => $puppetdb_database_host,
'database_host_puppetdb' => $primary_postgresql_host,
},
'puppet_enterprise::profile::puppetdb' => {
'database_host' => $puppetdb_database_host,
'database_host' => $primary_postgresql_host,
},
},
}
Expand All @@ -124,7 +124,7 @@
],
classes => {
'puppet_enterprise::profile::puppetdb' => {
'database_host' => $puppetdb_database_host,
'database_host' => $primary_postgresql_host,
},
'puppet_enterprise::profile::master' => {
# lint:ignore:single_quote_string_with_variables
Expand All @@ -143,7 +143,7 @@

# Create the replica and B groups if a replica primary and database host are
# supplied
if $primary_replica_host {
if $replica_host {
# We need to ensure this group provides the peadm_replica variable.
node_group { 'PE DR Replica':
ensure => 'present',
Expand All @@ -163,10 +163,10 @@
],
data => {
'puppet_enterprise::profile::primary_master_replica' => {
'database_host_puppetdb' => $puppetdb_database_replica_host,
'database_host_puppetdb' => $replica_postgresql_host,
},
'puppet_enterprise::profile::puppetdb' => {
'database_host' => $puppetdb_database_replica_host,
'database_host' => $replica_postgresql_host,
},
},
}
Expand All @@ -180,7 +180,7 @@
],
classes => {
'puppet_enterprise::profile::puppetdb' => {
'database_host' => $puppetdb_database_replica_host,
'database_host' => $replica_postgresql_host,
},
'puppet_enterprise::profile::master' => {
# lint:ignore:single_quote_string_with_variables
Expand Down
44 changes: 22 additions & 22 deletions plans/action/configure.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
plan peadm::action::configure (
# Standard
Peadm::SingleTargetSpec $primary_host,
Optional[Peadm::SingleTargetSpec] $primary_replica_host = undef,
Optional[Peadm::SingleTargetSpec] $replica_host = undef,

# Large
Optional[TargetSpec] $compiler_hosts = undef,

# Extra Large
Optional[Peadm::SingleTargetSpec] $puppetdb_database_host = undef,
Optional[Peadm::SingleTargetSpec] $puppetdb_database_replica_host = undef,
Optional[Peadm::SingleTargetSpec] $primary_postgresql_host = undef,
Optional[Peadm::SingleTargetSpec] $replica_postgresql_host = undef,

# Common Configuration
String $compiler_pool_address = $primary_host.peadm::certname(),
Expand All @@ -38,17 +38,17 @@

# Convert inputs into targets.
$primary_target = peadm::get_targets($primary_host, 1)
$primary_replica_target = peadm::get_targets($primary_replica_host, 1)
$puppetdb_database_replica_target = peadm::get_targets($puppetdb_database_replica_host, 1)
$replica_target = peadm::get_targets($replica_host, 1)
$replica_postgresql_target = peadm::get_targets($replica_postgresql_host, 1)
$compiler_targets = peadm::get_targets($compiler_hosts)
$puppetdb_database_target = peadm::get_targets($puppetdb_database_host, 1)
$primary_postgresql_target = peadm::get_targets($primary_postgresql_host, 1)

# Ensure input valid for a supported architecture
$arch = peadm::assert_supported_architecture(
$primary_host,
$primary_replica_host,
$puppetdb_database_host,
$puppetdb_database_replica_host,
$replica_host,
$primary_postgresql_host,
$replica_postgresql_host,
$compiler_hosts,
)

Expand All @@ -60,7 +60,7 @@
).first['content']

run_task('peadm::mkdir_p_file', peadm::flatten_compact([
$primary_replica_target,
$replica_target,
$compiler_targets,
]),
path => '/etc/puppetlabs/puppet/hiera.yaml',
Expand All @@ -79,9 +79,9 @@

class { 'peadm::setup::node_manager':
primary_host => $primary_target.peadm::certname(),
primary_replica_host => $primary_replica_target.peadm::certname(),
puppetdb_database_host => $puppetdb_database_target.peadm::certname(),
puppetdb_database_replica_host => $puppetdb_database_replica_target.peadm::certname(),
replica_host => $replica_target.peadm::certname(),
primary_postgresql_host => $primary_postgresql_target.peadm::certname(),
replica_postgresql_host => $replica_postgresql_target.peadm::certname(),
compiler_pool_address => $compiler_pool_address,
internal_compiler_a_pool_address => $internal_compiler_a_pool_address,
internal_compiler_b_pool_address => $internal_compiler_b_pool_address,
Expand All @@ -92,23 +92,23 @@
if $arch['disaster-recovery'] {
# Run the PE Replica Provision
run_task('peadm::provision_replica', $primary_target,
primary_replica => $primary_replica_target.peadm::certname(),
token_file => $token_file,
replica => $replica_target.peadm::certname(),
token_file => $token_file,

# Race condition, where the provision command checks PuppetDB status and
# probably gets "starting", but fails out because that's not "running".
# Can remove flag when that issue is fixed.
legacy => true,
legacy => true,
)
}

# Run Puppet everywhere to pick up last remaining config tweaks
run_task('peadm::puppet_runonce', peadm::flatten_compact([
$primary_target,
$puppetdb_database_target,
$primary_postgresql_target,
$compiler_targets,
$primary_replica_target,
$puppetdb_database_replica_target,
$replica_target,
$replica_postgresql_target,
]))

# Deploy an environment if a deploy environment is specified
Expand All @@ -121,9 +121,9 @@
# Ensure Puppet agent service is running now that configuration is complete
run_command('systemctl start puppet', peadm::flatten_compact([
$primary_target,
$primary_replica_target,
$puppetdb_database_target,
$puppetdb_database_replica_target,
$replica_target,
$primary_postgresql_target,
$replica_postgresql_target,
$compiler_targets,
]))

Expand Down
Loading

0 comments on commit 0b8af72

Please sign in to comment.