Skip to content

Commit

Permalink
Switch to using apply blocks for node_manager
Browse files Browse the repository at this point in the history
It took awhile to figure out how to do this, but I think this latest
iteration actually works.
  • Loading branch information
reidmv committed Nov 12, 2019
1 parent a573433 commit 3866ba0
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 299 deletions.
27 changes: 15 additions & 12 deletions manifests/setup/node_manager.pp
Expand Up @@ -61,18 +61,21 @@
variables => { 'pe_master' => true },
}

# This class has to be included here because puppet_enterprise is declared
# in the console with parameters. It is therefore not possible to include
# puppet_enterprise::profile::database in code without causing a conflict.
node_group { 'PE Database':
ensure => present,
parent => 'PE Infrastructure',
environment => 'production',
override_environment => false,
rule => ['and', ['=', ['trusted', 'extensions', 'pp_role'], 'pe_xl::puppetdb_database']],
classes => {
'puppet_enterprise::profile::database' => { },
},
# Create the database group if a database host is external
if ($puppetdb_database_host != $master_host) {
# This class has to be included here because puppet_enterprise is declared
# in the console with parameters. It is therefore not possible to include
# puppet_enterprise::profile::database in code without causing a conflict.
node_group { 'PE Database':
ensure => present,
parent => 'PE Infrastructure',
environment => 'production',
override_environment => false,
rule => ['and', ['=', ['trusted', 'extensions', 'pp_role'], 'pe_xl::puppetdb_database']],
classes => {
'puppet_enterprise::profile::database' => { },
},
}
}

# Create data-only groups to store PuppetDB PostgreSQL database configuration
Expand Down
33 changes: 0 additions & 33 deletions plans/test.pp

This file was deleted.

41 changes: 21 additions & 20 deletions plans/unit/configure.pp
Expand Up @@ -37,28 +37,29 @@
$compiler_hosts,
)

# Retrieve and deploy Puppet modules from the Forge so that they can be used
# for ensuring some configuration (node groups)
[ ['WhatsARanjit-node_manager', '0.7.1'],
['puppetlabs-stdlib', '5.0.0'],
].each |$tuple| {
run_plan('pe_xl::util::install_module',
nodes => $master_target,
module => $tuple[0],
version => $tuple[1],
stagingdir => $stagingdir,
)
}

# Set up the console node groups to configure the various hosts in their
# roles
run_task('pe_xl::configure_node_groups', $master_target,
master_host => $master_target.pe_xl::target_host(),
master_replica_host => $master_replica_target.pe_xl::target_host(),
puppetdb_database_host => $puppetdb_database_target.pe_xl::target_host(),
puppetdb_database_replica_host => $puppetdb_database_replica_target.pe_xl::target_host(),
compiler_pool_address => $compiler_pool_address,
)
apply($master_target) {
# Necessary to give the sandboxed Puppet executor the configuration
# necessary to connect to the classifier`
file { 'node_manager.yaml':
ensure => file,
mode => '0644',
path => Deferred('pe_xl::node_manager_yaml_location'),
content => epp('pe_xl/node_manager.yaml.epp', {
server => $servername,
}),
}

class { 'pe_xl::configure_node_groups':
master_host => $master_target.pe_xl::target_host(),
master_replica_host => $master_replica_target.pe_xl::target_host(),
puppetdb_database_host => $puppetdb_database_target.pe_xl::target_host(),
puppetdb_database_replica_host => $puppetdb_database_replica_target.pe_xl::target_host(),
compiler_pool_address => $compiler_pool_address,
require => File['node_manager.yaml'],
}
}

# Run Puppet in no-op on the compilers so that their status in PuppetDB
# is updated and they can be identified by the puppet_enterprise module as
Expand Down
29 changes: 0 additions & 29 deletions plans/util/install_module.pp

This file was deleted.

29 changes: 0 additions & 29 deletions tasks/configure_node_groups.json

This file was deleted.

176 changes: 0 additions & 176 deletions tasks/configure_node_groups.sh

This file was deleted.

0 comments on commit 3866ba0

Please sign in to comment.