Showing with 51 additions and 43 deletions.
  1. +0 −29 functions/install_module.pp
  2. +1 −1 metadata.json
  3. +10 −2 plans/configure.pp
  4. +5 −5 plans/install.pp
  5. +29 −0 plans/util/install_module.pp
  6. +6 −6 {functions → plans/util}/retrieve_and_upload.pp
29 changes: 0 additions & 29 deletions functions/install_module.pp

This file was deleted.

2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "reidmv-pe_xl",
"version": "0.2.1",
"version": "0.2.2",
"author": "Reid Vandewiele",
"summary": "Profile classes used to deploy an at-scale Puppet Enterprise architecture",
"license": "Apache-2.0",
Expand Down
12 changes: 10 additions & 2 deletions plans/configure.pp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,16 @@

# Retrieve and deploy Puppet modules from the Forge so that they can be used
# for ensuring some configuration (node groups)
pe_xl::install_module($master_target, 'WhatsARanjit-node_manager', '0.7.1', $stagingdir)
pe_xl::install_module($master_target, 'puppetlabs-stdlib', '5.0.0', $stagingdir)
[ ['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
Expand Down
10 changes: 5 additions & 5 deletions plans/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@
$local_tarball_path = "${stagingdir}/${pe_tarball_name}"
$upload_tarball_path = "/tmp/${pe_tarball_name}"

pe_xl::retrieve_and_upload(
"https://s3.amazonaws.com/pe-builds/released/${version}/puppet-enterprise-${version}-el-7-x86_64.tar.gz",
$local_tarball_path,
$upload_tarball_path,
[$master_host, $puppetdb_database_host, $puppetdb_database_replica_host]
run_plan('pe_xl::util::retrieve_and_upload',
nodes => [$master_host, $puppetdb_database_host, $puppetdb_database_replica_host],
source => "https://s3.amazonaws.com/pe-builds/released/${version}/puppet-enterprise-${version}-el-7-x86_64.tar.gz",
local_path => $local_tarball_path,
upload_path => $upload_tarball_path,
)

# Create csr_attributes.yaml files for the nodes that need them
Expand Down
29 changes: 29 additions & 0 deletions plans/util/install_module.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
plan pe_xl::util::install_module(
TargetSpec $nodes,
String[1] $module,
String[1] $version,
String[1] $stagingdir = '/tmp',
) {

$module_tarball = "${module.regsubst('/', '-')}-${version}.tar.gz"

run_plan('pe_xl::util::retrieve_and_upload',
nodes => $nodes,
source => "https://forge.puppet.com/v3/files/${module_tarball}",
local_path => "${stagingdir}/${module_tarball}",
upload_path => "/tmp/${module_tarball}",
)

run_command(@("HEREDOC"), $nodes)
/opt/puppetlabs/bin/puppet module install \
--modulepath /etc/puppetlabs/code-staging/environments/production/modules \
--ignore-dependencies \
/tmp/${module_tarball}
| HEREDOC

run_command('chown -R pe-puppet:pe-puppet /etc/puppetlabs/code-staging', $nodes)
run_task('pe_xl::code_manager', $nodes,
action => 'commit',
)

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
function pe_xl::retrieve_and_upload(
$source,
$local_path,
$upload_path,
$target,
plan pe_xl::util::retrieve_and_upload(
TargetSpec $nodes,
String[1] $source,
String[1] $local_path,
String[1] $upload_path,
) {
$exists = without_default_logging() || {
run_command("test -e '${local_path}'", 'local://localhost',
Expand All @@ -21,7 +21,7 @@ function pe_xl::retrieve_and_upload(
path => $local_path,
).first['size']

$targets_needing_file = run_task('pe_xl::filesize', $target,
$targets_needing_file = run_task('pe_xl::filesize', $nodes,
path => $upload_path,
).filter |$result| {
$result['size'] != $local_size
Expand Down