diff --git a/README.md b/README.md index e79081e5..576dc54b 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# Puppet Enterprise Extra Large +# Puppet Enterprise (pe) Administration (adm) Module -This Puppet module contains Puppet Task Plans used to deploy an at-scale Puppet Enterprise architecture. +This Puppet module contains Puppet Task Plans used to deploy and manage at-scale Puppet Enterprise architecture. -Use this module to deploy Puppet Enterprise 2019.0.x Extra Large architecture. +Use this module to deploy Puppet Enterprise 2019.x Standard, Large, and Extra Large architecture. * This deployment depends on and assumes the use of trusted facts. Specifically, `pp_role` and `pp_environment`. * This deployment assumes that at least for PE infrastructure nodes, Puppet certnames are correct, resolvable FQDNs. diff --git a/documentation/basic_usage.md b/documentation/basic_usage.md index bf4dc86d..d1c5e4ed 100644 --- a/documentation/basic_usage.md +++ b/documentation/basic_usage.md @@ -14,21 +14,21 @@ Provisioning can be broken down into two actions: [install](../plans/unit/instal Besides getting Puppet Enterprise installed, the key configuration supporting Large and Extra Large architectures is laid out in four classification groups. Links are provided below to a Markdown document that describes the groups, and also to the Puppet manifest that actually configures them: * [classification.md](classification.md) -* [pe\_xl::node\_manager class](../manifests/node_manager.pp) +* [peadm::node\_manager class](../manifests/node_manager.pp) The reference implementation uses trusted facts to put nodes in the right groups. Because the important puppet\_enterprise::\* class parameters and data are specified in the console, it should also be safe to have a pe.conf present on both the master, and the master replica nodes. ## Basic usage instructions 1. Install Bolt on a jumphost. This can be the master, or any other system. -2. Download or git clone the pe\_xl module and put it somewhere on the jumphost. e.g. ~/modules/pe\_xl. +2. Download or git clone the peadm module and put it somewhere on the jumphost. e.g. ~/modules/peadm. 2. Download or git clone the module dependencies, and put them somewhere on the jumphost. e.g. ~/modules/stdlib, ~/modules/node\_manager, etc. 2. Ensure the hostname of each system is set correctly, to the same value that will be used to connect to the system, and refer to the system as. If the hostname is not set as expected the installation plan will refuse to continue. 4. Create an inventory file with connection information. Example included below. Available Bolt configuration options are documented here. 5. Create a parameters file. Example included below. Note at the top of the file are arguments which dictate which plans should be run, such as install+configure. -6. Run the pe\_xl plan with the inputs created. Example: +6. Run the peadm::provision plan with the inputs created. Example: - bolt plan run pe_xl::provision \ + bolt plan run peadm::provision \ --inventory nodes.yaml \ --modulepath ~/modules \ --params @params.json @@ -38,7 +38,7 @@ Example nodes.yaml Bolt inventory file: ```yaml --- groups: - - name: pe_xl_nodes + - name: pe_nodes config: transport: ssh ssh: diff --git a/documentation/install_and_configure_without_ha.md b/documentation/install_and_configure_without_ha.md index dae25ccd..f82bc86d 100644 --- a/documentation/install_and_configure_without_ha.md +++ b/documentation/install_and_configure_without_ha.md @@ -9,12 +9,12 @@ The install, configure, and upgrade plans covered in the [basic_usage.md](basic_ 1. Ensure the hostname of each system is set correctly, to the same value that will be used to connect to the system, and refer to the system as. If the hostname is not set as expected the installation plan will refuse to continue. 2. Install Bolt on a jumphost. This can be the master, or any other system. -3. Download or git clone the pe\_xl module and put it somewhere on the jumphost, e.g. ~/modules/pe\_xl. +3. Download or git clone the peadm module and put it somewhere on the jumphost, e.g. ~/modules/peadm. 4. Create an inventory file with connection information. An example is included below. 5. Create a parameters file. An example is included below. Note the omission of the `master_replica_host` and `puppetdb_database_replica_host` parameters. -6. Run the pe\_xl plan with the inputs created. Example: +6. Run the peadm plan with the inputs created. Example: ``` - bolt plan run pe_xl::provision \ + bolt plan run peadm::provision \ --inventory nodes.yaml \ --modulepath ~/modules \ --params @params.json @@ -26,7 +26,7 @@ The install, configure, and upgrade plans covered in the [basic_usage.md](basic_ --- groups: - - name: pe_xl_nodes + - name: peadm_nodes config: transport: ssh ssh: diff --git a/documentation/large_deploy.md b/documentation/large_deploy.md index f4a4b71f..c2ecc94e 100644 --- a/documentation/large_deploy.md +++ b/documentation/large_deploy.md @@ -24,14 +24,14 @@ deploy a PE Large Architecture. Ensuring that the parameters above are omitted from the `params.json` file, the [basic usage instructions](basic_usage.md#basic-usage-instructions) can be -used to run the `pe_xl` plan in order to install and configure the deployment. +used to run the `peadm` plan in order to install and configure the deployment. Example nodes.yaml Bolt inventory file: ```yaml --- groups: - - name: pe_xl_nodes + - name: peadm_nodes config: transport: ssh ssh: diff --git a/functions/fail_on_transport.pp b/functions/fail_on_transport.pp index 2e2f1780..f974f33e 100644 --- a/functions/fail_on_transport.pp +++ b/functions/fail_on_transport.pp @@ -2,7 +2,7 @@ # # Useful for excluding PCP when it's not appopriate # -function pe_xl::fail_on_transport ( +function peadm::fail_on_transport ( TargetSpec $nodes, String $transport, ) { diff --git a/functions/flatten_compact.pp b/functions/flatten_compact.pp index 82f054cc..49fd69e8 100644 --- a/functions/flatten_compact.pp +++ b/functions/flatten_compact.pp @@ -1,4 +1,4 @@ -function pe_xl::flatten_compact ( +function peadm::flatten_compact ( Array $input, ) { $input.flatten.filter |$value| { diff --git a/functions/generate_pe_conf.pp b/functions/generate_pe_conf.pp index faa1e0cf..fcd4921c 100644 --- a/functions/generate_pe_conf.pp +++ b/functions/generate_pe_conf.pp @@ -5,7 +5,7 @@ # undef will not be included in the config file. This is done to reduce the # amount of logic required within plans if parameters are not passed in. # -function pe_xl::generate_pe_conf ( +function peadm::generate_pe_conf ( Hash $settings, ) { # Check that console_admin_password is present diff --git a/functions/get_targets.pp b/functions/get_targets.pp index 3c9d4d90..c0438d79 100644 --- a/functions/get_targets.pp +++ b/functions/get_targets.pp @@ -2,7 +2,7 @@ # This differs from get_target() in that: # - It returns an Array[Target, 1, 0], rather than a Target # - It will accept undef and return [ ]. -function pe_xl::get_targets( +function peadm::get_targets( Variant[TargetSpec, Undef] $spec, Optional[Integer[1,1]] $count = undef, ) { diff --git a/functions/print_apply_result.pp b/functions/print_apply_result.pp deleted file mode 100644 index 12c768cf..00000000 --- a/functions/print_apply_result.pp +++ /dev/null @@ -1,20 +0,0 @@ -function pe_xl::print_apply_result( - Variant[ApplyResult, ResultSet] $result, -) { - $enumerable = $result ? { - ResultSet => $result, - default => [$result], - } - - $enumerable.each |ApplyResult $apply| { - $apply.report['logs'].each |$log| { - # TODO: include file and line number, if present - notice("${log['time']} ${log['level'].upcase} ${log['source']} ${log['message']}") - } - - $status = $apply.report['status'] - $message = $apply.message - $target = $apply.target.name - notice("\"${status}\" on ${target}: ${message}") - } -} diff --git a/functions/target_host.pp b/functions/target_host.pp index 49676fef..a3cdda8f 100644 --- a/functions/target_host.pp +++ b/functions/target_host.pp @@ -1,4 +1,4 @@ -function pe_xl::target_host( +function peadm::target_host( Variant[Target, Array[Target,0,1]] $target, ) >> Variant[String, Undef] { case $target { @@ -11,5 +11,8 @@ function pe_xl::target_host( Array[Target,0,0]: { undef } + default: { + fail('Unexpected input type to peadm::target_host function') + } } } diff --git a/functions/validate_architecture.pp b/functions/validate_architecture.pp index 1fe12184..652da05f 100644 --- a/functions/validate_architecture.pp +++ b/functions/validate_architecture.pp @@ -1,4 +1,4 @@ -function pe_xl::validate_architecture ( +function peadm::validate_architecture ( TargetSpec $master_host, Variant[TargetSpec, Undef] $master_replica_host = undef, Variant[TargetSpec, Undef] $puppetdb_database_host = undef, diff --git a/installer/primary-master/csr_attributes.yaml b/installer/primary-master/csr_attributes.yaml index 3154cf84..4e504235 100644 --- a/installer/primary-master/csr_attributes.yaml +++ b/installer/primary-master/csr_attributes.yaml @@ -1,4 +1,4 @@ --- extension_requests: - pp_role: "pe_xl::master" + pp_role: "peadm::master" pp_environment: "pe_production" diff --git a/installer/puppetdb-database/csr_attributes.yaml b/installer/puppetdb-database/csr_attributes.yaml index 52d29d69..edbc594f 100644 --- a/installer/puppetdb-database/csr_attributes.yaml +++ b/installer/puppetdb-database/csr_attributes.yaml @@ -1,4 +1,4 @@ --- extension_requests: - pp_role: "pe_xl::puppetdb_database" + pp_role: "peadm::puppetdb_database" pp_environment: "pe_production" diff --git a/lib/puppet/functions/pe_xl/file_content_upload.rb b/lib/puppet/functions/peadm/file_content_upload.rb similarity index 84% rename from lib/puppet/functions/pe_xl/file_content_upload.rb rename to lib/puppet/functions/peadm/file_content_upload.rb index f727ee91..3852e399 100644 --- a/lib/puppet/functions/pe_xl/file_content_upload.rb +++ b/lib/puppet/functions/peadm/file_content_upload.rb @@ -1,6 +1,6 @@ require 'tempfile' -Puppet::Functions.create_function(:'pe_xl::file_content_upload') do +Puppet::Functions.create_function(:'peadm::file_content_upload') do local_types do type 'TargetOrTargets = Variant[String[1], Target, Array[TargetOrTargets]]' end @@ -12,7 +12,7 @@ end def file_content_upload(content, destination, *targets) - file = Tempfile.new('pe_xl') + file = Tempfile.new('peadm') file.write(content) file.flush result = call_function('upload_file', file.path, destination, *targets) diff --git a/lib/puppet/functions/pe_xl/node_manager_yaml_location.rb b/lib/puppet/functions/peadm/node_manager_yaml_location.rb similarity index 58% rename from lib/puppet/functions/pe_xl/node_manager_yaml_location.rb rename to lib/puppet/functions/peadm/node_manager_yaml_location.rb index 6e8408fc..82688922 100644 --- a/lib/puppet/functions/pe_xl/node_manager_yaml_location.rb +++ b/lib/puppet/functions/peadm/node_manager_yaml_location.rb @@ -1,8 +1,8 @@ -Puppet::Functions.create_function(:'pe_xl::node_manager_yaml_location') do +Puppet::Functions.create_function(:'peadm::node_manager_yaml_location') do dispatch :nm_yaml_location do end - def nm_yaml_location() + def nm_yaml_location File.join(Puppet.settings['confdir'], 'node_manager.yaml') end end diff --git a/manifests/compiler.pp b/manifests/compiler.pp index 9ceb70f9..ca63d9d7 100644 --- a/manifests/compiler.pp +++ b/manifests/compiler.pp @@ -1,6 +1,6 @@ # @summary Example class for PE compiler load balancing # -class pe_xl::compiler { +class peadm::compiler { @@haproxy::balancermember { "${::clientcert}_puppetserver_listener": listening_service => 'puppetserver', diff --git a/manifests/load_balancer.pp b/manifests/load_balancer.pp index e2f83d05..08bd39d2 100644 --- a/manifests/load_balancer.pp +++ b/manifests/load_balancer.pp @@ -1,6 +1,6 @@ # @summary Example class for PE compiler load balancer # -class pe_xl::load_balancer { +class peadm::load_balancer { class { 'haproxy': global_options => { diff --git a/manifests/puppetdb.pp b/manifests/puppetdb.pp index 239ddf5e..cdd37fad 100644 --- a/manifests/puppetdb.pp +++ b/manifests/puppetdb.pp @@ -1,6 +1,6 @@ # @summary Example class for PE PuppetDB load balancing # -class pe_xl::puppetdb { +class peadm::puppetdb { # TODO: split load balancing into two pools, A and B @@haproxy::balancermember { "${::clientcert}_puppetdb_listener": diff --git a/manifests/setup/node_manager.pp b/manifests/setup/node_manager.pp index a2fd5a15..cddaf633 100644 --- a/manifests/setup/node_manager.pp +++ b/manifests/setup/node_manager.pp @@ -7,11 +7,11 @@ # This class will be applied during master bootstrap using e.g. # # puppet apply \ -# --exec 'class { "pe_xl::node_manager": +# --exec 'class { "peadm::node_manager": # environments => ["production", "staging", "development"], # }' # -class pe_xl::setup::node_manager ( +class peadm::setup::node_manager ( String[1] $master_host, String[1] $puppetdb_database_host, String[1] $compiler_pool_address, @@ -43,7 +43,7 @@ # We modify this group's rule such that all PE infrastructure nodes will be # members. node_group { 'PE Infrastructure Agent': - rule => ['and', ['~', ['trusted', 'extensions', 'pp_role'], '^pe_xl::']], + rule => ['and', ['~', ['trusted', 'extensions', 'pp_role'], '^peadm::']], } # We modify this group to add, as data, the compiler_pool_address only. @@ -52,7 +52,7 @@ node_group { 'PE Master': parent => 'PE Infrastructure', rule => ['or', - ['and', ['=', ['trusted', 'extensions', 'pp_role'], 'pe_xl::compiler']], + ['and', ['=', ['trusted', 'extensions', 'pp_role'], 'peadm::compiler']], ['=', 'name', $master_host], ], data => { @@ -71,7 +71,7 @@ parent => 'PE Infrastructure', environment => 'production', override_environment => false, - rule => ['and', ['=', ['trusted', 'extensions', 'pp_role'], 'pe_xl::puppetdb_database']], + rule => ['and', ['=', ['trusted', 'extensions', 'pp_role'], 'peadm::puppetdb_database']], classes => { 'puppet_enterprise::profile::database' => { }, }, @@ -84,7 +84,7 @@ ensure => present, parent => 'PE Infrastructure', rule => ['and', - ['=', ['trusted', 'extensions', 'pp_role'], 'pe_xl::master'], + ['=', ['trusted', 'extensions', 'pp_role'], 'peadm::master'], ['=', ['trusted', 'extensions', 'pp_cluster'], 'A'], ], data => { @@ -103,7 +103,7 @@ ensure => 'present', parent => 'PE Master', rule => ['and', - ['=', ['trusted', 'extensions', 'pp_role'], 'pe_xl::compiler'], + ['=', ['trusted', 'extensions', 'pp_role'], 'peadm::compiler'], ['=', ['trusted', 'extensions', 'pp_cluster'], 'A'], ], classes => { @@ -131,14 +131,14 @@ classes => { 'puppet_enterprise::profile::primary_master_replica' => { } }, - variables => { 'pe_xl_replica' => true }, + variables => { 'peadm_replica' => true }, } node_group { 'PE Master B': ensure => present, parent => 'PE Infrastructure', rule => ['and', - ['=', ['trusted', 'extensions', 'pp_role'], 'pe_xl::master'], + ['=', ['trusted', 'extensions', 'pp_role'], 'peadm::master'], ['=', ['trusted', 'extensions', 'pp_cluster'], 'B'], ], data => { @@ -155,7 +155,7 @@ ensure => 'present', parent => 'PE Master', rule => ['and', - ['=', ['trusted', 'extensions', 'pp_role'], 'pe_xl::compiler'], + ['=', ['trusted', 'extensions', 'pp_role'], 'peadm::compiler'], ['=', ['trusted', 'extensions', 'pp_cluster'], 'B'], ], classes => { diff --git a/metadata.json b/metadata.json index ee7a2b0b..ddbaab62 100644 --- a/metadata.json +++ b/metadata.json @@ -1,12 +1,12 @@ { - "name": "puppetlabs-pe_xl", + "name": "puppetlabs-peadm", "version": "0.4.0", "author": "Reid Vandewiele", "summary": "Bolt plans used to deploy an at-scale Puppet Enterprise architecture", "license": "Apache-2.0", - "source": "https://github.com/puppetlabs/puppetlabs-pe_xl", - "project_page": "https://github.com/puppetlabs/puppetlabs-pe_xl", - "issues_url": "https://github.com/puppetlabs/puppetlabs-pe_xl/issues", + "source": "https://github.com/puppetlabs/puppetlabs-peadm", + "project_page": "https://github.com/puppetlabs/puppetlabs-peadm", + "issues_url": "https://github.com/puppetlabs/puppetlabs-peadm/issues", "dependencies": [ { "name": "puppetlabs/stdlib", diff --git a/plans/misc/divert_code_manager.pp b/plans/misc/divert_code_manager.pp index a6b82b77..6a578d1d 100644 --- a/plans/misc/divert_code_manager.pp +++ b/plans/misc/divert_code_manager.pp @@ -10,7 +10,7 @@ # # This is a stop-gap at best. This should not be attempted without advisement. # -plan pe_xl::misc::divert_code_manager ( +plan peadm::misc::divert_code_manager ( $master_host, ) { @@ -21,7 +21,7 @@ This will allow /etc/puppetlabs/code to be managed manually | HEREDOC - run_task('pe_xl::divert_code_manager', $master_host) + run_task('peadm::divert_code_manager', $master_host) notice(@(HEREDOC)) Remember to enforce this configuration in your Puppet code with a Collector Override. E.g. diff --git a/plans/provision.pp b/plans/provision.pp index 89a14683..0cd1b6d4 100644 --- a/plans/provision.pp +++ b/plans/provision.pp @@ -2,17 +2,17 @@ # Puppet Enterprise Extra Large cluster. This plan accepts all parameters # used by its sub-plans, and invokes them in order. # -plan pe_xl::provision ( +plan peadm::provision ( # Standard - Pe_xl::SingleTargetSpec $master_host, - Optional[Pe_xl::SingleTargetSpec] $master_replica_host = undef, + Peadm::SingleTargetSpec $master_host, + Optional[Peadm::SingleTargetSpec] $master_replica_host = undef, # Large Optional[TargetSpec] $compiler_hosts = undef, # Extra Large - Optional[Pe_xl::SingleTargetSpec] $puppetdb_database_host = undef, - Optional[Pe_xl::SingleTargetSpec] $puppetdb_database_replica_host = undef, + Optional[Peadm::SingleTargetSpec] $puppetdb_database_host = undef, + Optional[Peadm::SingleTargetSpec] $puppetdb_database_replica_host = undef, # Common Configuration String $console_password, @@ -24,14 +24,14 @@ # Code Manager Optional[String] $r10k_remote = undef, Optional[String] $r10k_private_key_file = undef, - Optional[Pe_xl::Pem] $r10k_private_key_content = undef, + Optional[Peadm::Pem] $r10k_private_key_content = undef, Optional[String] $deploy_environment = undef, # Other Optional[String] $stagingdir = undef, ) { - $install_result = run_plan('pe_xl::unit::install', + $install_result = run_plan('peadm::unit::install', # Standard master_host => $master_host, master_replica_host => $master_replica_host, @@ -58,7 +58,7 @@ stagingdir => $stagingdir, ) - $configure_result = run_plan('pe_xl::unit::configure', + $configure_result = run_plan('peadm::unit::configure', # Standard master_host => $master_host, master_replica_host => $master_replica_host, diff --git a/plans/unit/configure.pp b/plans/unit/configure.pp index 84de957d..16be4de5 100644 --- a/plans/unit/configure.pp +++ b/plans/unit/configure.pp @@ -1,14 +1,14 @@ # @summary Configure first-time classification and HA setup # -plan pe_xl::unit::configure ( +plan peadm::unit::configure ( # Large - Pe_xl::SingleTargetSpec $master_host, + Peadm::SingleTargetSpec $master_host, Optional[TargetSpec] $compiler_hosts = undef, - Optional[Pe_xl::SingleTargetSpec] $master_replica_host = undef, + Optional[Peadm::SingleTargetSpec] $master_replica_host = undef, # Extra Large - Optional[Pe_xl::SingleTargetSpec] $puppetdb_database_host = undef, - Optional[Pe_xl::SingleTargetSpec] $puppetdb_database_replica_host = undef, + Optional[Peadm::SingleTargetSpec] $puppetdb_database_host = undef, + Optional[Peadm::SingleTargetSpec] $puppetdb_database_replica_host = undef, # Common Configuration String $compiler_pool_address = $master_host, @@ -19,17 +19,17 @@ String $stagingdir = '/tmp', ) { # Convert inputs into targets. - $master_target = pe_xl::get_targets($master_host, 1) - $master_replica_target = pe_xl::get_targets($master_replica_host, 1) - $puppetdb_database_replica_target = pe_xl::get_targets($puppetdb_database_replica_host, 1) - $compiler_targets = pe_xl::get_targets($compiler_hosts) + $master_target = peadm::get_targets($master_host, 1) + $master_replica_target = peadm::get_targets($master_replica_host, 1) + $puppetdb_database_replica_target = peadm::get_targets($puppetdb_database_replica_host, 1) + $compiler_targets = peadm::get_targets($compiler_hosts) $puppetdb_database_target = $puppetdb_database_host ? { undef => $master_target, - default => pe_xl::get_targets($puppetdb_database_host, 1) + default => peadm::get_targets($puppetdb_database_host, 1) } # Ensure input valid for a supported architecture - $arch = pe_xl::validate_architecture( + $arch = peadm::validate_architecture( $master_host, $master_replica_host, $puppetdb_database_host, @@ -46,29 +46,29 @@ # commented-out values should be used once GH-1244 is resolved. # WORKAROUND: GH-1244 - $master_host_string = $master_target.pe_xl::target_host() - $master_replica_host_string = $master_replica_target.pe_xl::target_host() - $puppetdb_database_host_string = $puppetdb_database_target.pe_xl::target_host() - $puppetdb_database_replica_host_string = $puppetdb_database_replica_target.pe_xl::target_host() + $master_host_string = $master_target.peadm::target_host() + $master_replica_host_string = $master_replica_target.peadm::target_host() + $puppetdb_database_host_string = $puppetdb_database_target.peadm::target_host() + $puppetdb_database_replica_host_string = $puppetdb_database_replica_target.peadm::target_host() 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', { + ensure => file, + mode => '0644', + path => Deferred('peadm::node_manager_yaml_location'), + content => epp('peadm/node_manager.yaml.epp', { server => $master_host_string, }), } - class { 'pe_xl::setup::node_manager': + class { 'peadm::setup::node_manager': # WORKAROUND: GH-1244 - master_host => $master_host_string, # $master_target.pe_xl::target_host(), - master_replica_host => $master_replica_host_string, # $master_replica_target.pe_xl::target_host(), - puppetdb_database_host => $puppetdb_database_host_string, # $puppetdb_database_target.pe_xl::target_host(), - puppetdb_database_replica_host => $puppetdb_database_replica_host_string, # $puppetdb_database_replica_target.pe_xl::target_host(), + master_host => $master_host_string, # $master_target.peadm::target_host(), + master_replica_host => $master_replica_host_string, # $master_replica_target.peadm::target_host(), + puppetdb_database_host => $puppetdb_database_host_string, # $puppetdb_database_target.peadm::target_host(), + puppetdb_database_replica_host => $puppetdb_database_replica_host_string, # $puppetdb_database_replica_target.peadm::target_host(), compiler_pool_address => $compiler_pool_address, require => File['node_manager.yaml'], } @@ -77,7 +77,7 @@ # 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 # CMs - run_task('pe_xl::puppet_runonce', pe_xl::flatten_compact([ + run_task('peadm::puppet_runonce', peadm::flatten_compact([ $compiler_targets, $master_replica_target, ]), @@ -86,7 +86,7 @@ # Run Puppet on the PuppetDB Database hosts to update their auth # configuration to allow the compilers to connect - run_task('pe_xl::puppet_runonce', pe_xl::flatten_compact([ + run_task('peadm::puppet_runonce', peadm::flatten_compact([ $puppetdb_database_target, $puppetdb_database_replica_target, ])) @@ -95,24 +95,24 @@ # running in prep for provisioning the replica. This is done separately so # that a service restart of pe-puppetserver doesn't cause Puppet runs on # other nodes to fail. - run_task('pe_xl::puppet_runonce', $master_target) + run_task('peadm::puppet_runonce', $master_target) if $arch['high-availability'] { # Run the PE Replica Provision - run_task('pe_xl::provision_replica', $master_target, - master_replica => $master_replica_target.pe_xl::target_host(), + run_task('peadm::provision_replica', $master_target, + master_replica => $master_replica_target.peadm::target_host(), token_file => $token_file, ) # Run the PE Replica Enable - run_task('pe_xl::enable_replica', $master_target, - master_replica => $master_replica_target.pe_xl::target_host(), + run_task('peadm::enable_replica', $master_target, + master_replica => $master_replica_target.peadm::target_host(), token_file => $token_file, ) } # Run Puppet everywhere to pick up last remaining config tweaks - run_task('pe_xl::puppet_runonce', pe_xl::flatten_compact([ + run_task('peadm::puppet_runonce', peadm::flatten_compact([ $master_target, $puppetdb_database_target, $compiler_targets, @@ -122,7 +122,7 @@ # Deploy an environment if a deploy environment is specified if $deploy_environment { - run_task('pe_xl::code_manager', $master_target, + run_task('peadm::code_manager', $master_target, action => "deploy ${deploy_environment}", ) } diff --git a/plans/unit/install.pp b/plans/unit/install.pp index 50f84ec9..31b97272 100644 --- a/plans/unit/install.pp +++ b/plans/unit/install.pp @@ -13,17 +13,17 @@ # Config data to plane into pe.conf when generated on all hosts, this can be # used for tuning data etc. # -plan pe_xl::unit::install ( +plan peadm::unit::install ( # Standard - Pe_xl::SingleTargetSpec $master_host, - Optional[Pe_xl::SingleTargetSpec] $master_replica_host = undef, + Peadm::SingleTargetSpec $master_host, + Optional[Peadm::SingleTargetSpec] $master_replica_host = undef, # Large Optional[TargetSpec] $compiler_hosts = undef, # Extra Large - Optional[Pe_xl::SingleTargetSpec] $puppetdb_database_host = undef, - Optional[Pe_xl::SingleTargetSpec] $puppetdb_database_replica_host = undef, + Optional[Peadm::SingleTargetSpec] $puppetdb_database_host = undef, + Optional[Peadm::SingleTargetSpec] $puppetdb_database_replica_host = undef, # Common Configuration String $console_password, @@ -34,20 +34,20 @@ # Code Manager Optional[String] $r10k_remote = undef, Optional[String] $r10k_private_key_file = undef, - Optional[Pe_xl::Pem] $r10k_private_key_content = undef, + Optional[Peadm::Pem] $r10k_private_key_content = undef, # Other String $stagingdir = '/tmp', ) { # Convert inputs into targets. - $master_target = pe_xl::get_targets($master_host, 1) - $master_replica_target = pe_xl::get_targets($master_replica_host, 1) - $puppetdb_database_target = pe_xl::get_targets($puppetdb_database_host, 1) - $puppetdb_database_replica_target = pe_xl::get_targets($puppetdb_database_replica_host, 1) - $compiler_targets = pe_xl::get_targets($compiler_hosts) + $master_target = peadm::get_targets($master_host, 1) + $master_replica_target = peadm::get_targets($master_replica_host, 1) + $puppetdb_database_target = peadm::get_targets($puppetdb_database_host, 1) + $puppetdb_database_replica_target = peadm::get_targets($puppetdb_database_replica_host, 1) + $compiler_targets = peadm::get_targets($compiler_hosts) # Ensure input valid for a supported architecture - $arch = pe_xl::validate_architecture( + $arch = peadm::validate_architecture( $master_host, $master_replica_host, $puppetdb_database_host, @@ -55,7 +55,7 @@ $compiler_hosts, ) - $all_targets = pe_xl::flatten_compact([ + $all_targets = peadm::flatten_compact([ $master_target, $puppetdb_database_target, $master_replica_target, @@ -63,18 +63,18 @@ $compiler_targets, ]) - $database_targets = pe_xl::flatten_compact([ + $database_targets = peadm::flatten_compact([ $puppetdb_database_target, $puppetdb_database_replica_target, ]) - $pe_installer_targets = pe_xl::flatten_compact([ + $pe_installer_targets = peadm::flatten_compact([ $master_target, $puppetdb_database_target, $puppetdb_database_replica_target, ]) - $agent_installer_targets = pe_xl::flatten_compact([ + $agent_installer_targets = peadm::flatten_compact([ $compiler_targets, $master_replica_target, ]) @@ -97,7 +97,7 @@ $r10k_private_key = [ $r10k_private_key_file, $r10k_private_key_content, - ].pe_xl::flatten_compact.size ? { + ].peadm::flatten_compact.size ? { 0 => undef, # no key data supplied 2 => fail('Must specify either one or neither of r10k_private_key_file and r10k_private_key_content; not both'), 1 => $r10k_private_key_file ? { @@ -108,81 +108,81 @@ # Validate that the name given for each system is both a resolvable name AND # the configured hostname. - run_task('pe_xl::hostname', $all_targets).each |$result| { + run_task('peadm::hostname', $all_targets).each |$result| { if $result.target.name != $result['hostname'] { fail_plan("Hostname / DNS name mismatch: target ${result.target.name} reports '${result['hostname']}'") } } # Generate all the needed pe.conf files - $master_pe_conf = pe_xl::generate_pe_conf({ + $master_pe_conf = peadm::generate_pe_conf({ 'console_admin_password' => $console_password, - 'puppet_enterprise::puppet_master_host' => $master_target.pe_xl::target_host(), + 'puppet_enterprise::puppet_master_host' => $master_target.peadm::target_host(), 'pe_install::puppet_master_dnsaltnames' => $dns_alt_names, - 'puppet_enterprise::profile::puppetdb::database_host' => $puppetdb_database_target.pe_xl::target_host(), + 'puppet_enterprise::profile::puppetdb::database_host' => $puppetdb_database_target.peadm::target_host(), 'puppet_enterprise::profile::master::code_manager_auto_configure' => true, 'puppet_enterprise::profile::master::r10k_private_key' => '/etc/puppetlabs/puppetserver/ssh/id-control_repo.rsa', 'puppet_enterprise::profile::master::r10k_remote' => $r10k_remote, } + $pe_conf_data) - $puppetdb_database_pe_conf = pe_xl::generate_pe_conf({ + $puppetdb_database_pe_conf = peadm::generate_pe_conf({ 'console_admin_password' => 'not used', - 'puppet_enterprise::puppet_master_host' => $master_target.pe_xl::target_host(), - 'puppet_enterprise::database_host' => $puppetdb_database_target.pe_xl::target_host(), + 'puppet_enterprise::puppet_master_host' => $master_target.peadm::target_host(), + 'puppet_enterprise::database_host' => $puppetdb_database_target.peadm::target_host(), } + $pe_conf_data) - $puppetdb_database_replica_pe_conf = pe_xl::generate_pe_conf({ + $puppetdb_database_replica_pe_conf = peadm::generate_pe_conf({ 'console_admin_password' => 'not used', - 'puppet_enterprise::puppet_master_host' => $master_target.pe_xl::target_host(), - 'puppet_enterprise::database_host' => $puppetdb_database_replica_target.pe_xl::target_host(), + 'puppet_enterprise::puppet_master_host' => $master_target.peadm::target_host(), + 'puppet_enterprise::database_host' => $puppetdb_database_replica_target.peadm::target_host(), } + $pe_conf_data) # Upload the pe.conf files to the hosts that need them - pe_xl::file_content_upload($master_pe_conf, '/tmp/pe.conf', $master_target) - pe_xl::file_content_upload($puppetdb_database_pe_conf, '/tmp/pe.conf', $puppetdb_database_target) - pe_xl::file_content_upload($puppetdb_database_replica_pe_conf, '/tmp/pe.conf', $puppetdb_database_replica_target) + peadm::file_content_upload($master_pe_conf, '/tmp/pe.conf', $master_target) + peadm::file_content_upload($puppetdb_database_pe_conf, '/tmp/pe.conf', $puppetdb_database_target) + peadm::file_content_upload($puppetdb_database_replica_pe_conf, '/tmp/pe.conf', $puppetdb_database_replica_target) # Download the PE tarball and send it to the nodes that need it $pe_tarball_name = "puppet-enterprise-${version}-el-7-x86_64.tar.gz" $local_tarball_path = "${stagingdir}/${pe_tarball_name}" $upload_tarball_path = "/tmp/${pe_tarball_name}" - run_plan('pe_xl::util::retrieve_and_upload', $pe_installer_targets, + run_plan('peadm::util::retrieve_and_upload', $pe_installer_targets, 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 - run_task('pe_xl::mkdir_p_file', $master_target, + run_task('peadm::mkdir_p_file', $master_target, path => '/etc/puppetlabs/puppet/csr_attributes.yaml', content => @(HEREDOC), --- extension_requests: pp_application: "puppet" - pp_role: "pe_xl::master" + pp_role: "peadm::master" pp_cluster: "A" | HEREDOC ) - run_task('pe_xl::mkdir_p_file', $puppetdb_database_target, + run_task('peadm::mkdir_p_file', $puppetdb_database_target, path => '/etc/puppetlabs/puppet/csr_attributes.yaml', content => @(HEREDOC), --- extension_requests: pp_application: "puppet" - pp_role: "pe_xl::puppetdb_database" + pp_role: "peadm::puppetdb_database" pp_cluster: "A" | HEREDOC ) - run_task('pe_xl::mkdir_p_file', $puppetdb_database_replica_target, + run_task('peadm::mkdir_p_file', $puppetdb_database_replica_target, path => '/etc/puppetlabs/puppet/csr_attributes.yaml', content => @(HEREDOC), --- extension_requests: pp_application: "puppet" - pp_role: "pe_xl::puppetdb_database" + pp_role: "peadm::puppetdb_database" pp_cluster: "B" | HEREDOC ) @@ -192,18 +192,18 @@ # is set. That's expected. $shortcircuit_puppetdb = !($puppetdb_database_target.empty) without_default_logging() || { - out::message("Starting: task pe_xl::pe_install on ${master_target[0].name}") - run_task('pe_xl::pe_install', $master_target, + out::message("Starting: task peadm::pe_install on ${master_target[0].name}") + run_task('peadm::pe_install', $master_target, _catch_errors => $shortcircuit_puppetdb, tarball => $upload_tarball_path, peconf => '/tmp/pe.conf', shortcircuit_puppetdb => $shortcircuit_puppetdb, ) - out::message("Finished: task pe_xl::pe_install on ${master_target[0].name}") + out::message("Finished: task peadm::pe_install on ${master_target[0].name}") } if $r10k_private_key { - run_task('pe_xl::mkdir_p_file', [$master_target, $master_replica_target], + run_task('peadm::mkdir_p_file', [$master_target, $master_replica_target], path => '/etc/puppetlabs/puppetserver/ssh/id-control_repo.rsa', owner => 'pe-puppet', group => 'pe-puppet', @@ -214,7 +214,7 @@ # Configure autosigning for the puppetdb database hosts 'cause they need it $autosign_conf = $database_targets.reduce('') |$memo,$target| { "${target.host}\n${memo}" } - run_task('pe_xl::mkdir_p_file', $master_target, + run_task('peadm::mkdir_p_file', $master_target, path => '/etc/puppetlabs/puppet/autosign.conf', owner => 'pe-puppet', group => 'pe-puppet', @@ -223,7 +223,7 @@ ) # Run the PE installer on the puppetdb database hosts - run_task('pe_xl::pe_install', $database_targets, + run_task('peadm::pe_install', $database_targets, tarball => $upload_tarball_path, peconf => '/tmp/pe.conf', ) @@ -232,7 +232,7 @@ # master. Explicitly stop puppetdb first to avoid any systemd interference. run_command('systemctl stop pe-puppetdb', $master_target) run_command('systemctl start pe-puppetdb', $master_target) - run_task('pe_xl::rbac_token', $master_target, + run_task('peadm::rbac_token', $master_target, password => $console_password, ) @@ -241,7 +241,7 @@ # replication. A production environment must exist when committed to avoid # corrupting the PE console. Create the site.pp file specifically to avoid # breaking the `puppet infra configure` command. - run_task('pe_xl::mkdir_p_file', $master_target, + run_task('peadm::mkdir_p_file', $master_target, path => '/etc/puppetlabs/code-staging/environments/production/manifests/site.pp', chown_r => '/etc/puppetlabs/code-staging/environments', owner => 'pe-puppet', @@ -250,40 +250,40 @@ content => "# Empty manifest\n", ) - run_task('pe_xl::code_manager', $master_target, + run_task('peadm::code_manager', $master_target, action => 'file-sync commit', ) # Deploy the PE agent to all remaining hosts - run_task('pe_xl::agent_install', $master_replica_target, - server => $master_target.pe_xl::target_host(), + run_task('peadm::agent_install', $master_replica_target, + server => $master_target.peadm::target_host(), install_flags => [ '--puppet-service-ensure', 'stopped', "main:dns_alt_names=${dns_alt_names_csv}", 'extension_requests:pp_application=puppet', - 'extension_requests:pp_role=pe_xl::master', + 'extension_requests:pp_role=peadm::master', 'extension_requests:pp_cluster=B', ], ) - run_task('pe_xl::agent_install', $compiler_a_targets, - server => $master_target.pe_xl::target_host(), + run_task('peadm::agent_install', $compiler_a_targets, + server => $master_target.peadm::target_host(), install_flags => [ '--puppet-service-ensure', 'stopped', "main:dns_alt_names=${dns_alt_names_csv}", 'extension_requests:pp_application=puppet', - 'extension_requests:pp_role=pe_xl::compiler', + 'extension_requests:pp_role=peadm::compiler', 'extension_requests:pp_cluster=A', ], ) - run_task('pe_xl::agent_install', $compiler_b_targets, - server => $master_target.pe_xl::target_host(), + run_task('peadm::agent_install', $compiler_b_targets, + server => $master_target.peadm::target_host(), install_flags => [ '--puppet-service-ensure', 'stopped', "main:dns_alt_names=${dns_alt_names_csv}", 'extension_requests:pp_application=puppet', - 'extension_requests:pp_role=pe_xl::compiler', + 'extension_requests:pp_role=peadm::compiler', 'extension_requests:pp_cluster=B', ], ) @@ -305,8 +305,8 @@ | HEREDOC } - run_task('pe_xl::puppet_runonce', $master_target) - run_task('pe_xl::puppet_runonce', $all_targets - $master_target) + run_task('peadm::puppet_runonce', $master_target) + run_task('peadm::puppet_runonce', $all_targets - $master_target) return("Installation of Puppet Enterprise ${arch['architecture']} succeeded.") } diff --git a/plans/upgrade.pp b/plans/upgrade.pp index ac972707..c88f0010 100644 --- a/plans/upgrade.pp +++ b/plans/upgrade.pp @@ -1,6 +1,6 @@ # @summary Upgrade an Extra Large stack from one .z to the next # -plan pe_xl::upgrade ( +plan peadm::upgrade ( String[1] $master_host, String[1] $puppetdb_database_host, Optional[String[1]] $master_replica_host = undef, @@ -8,7 +8,7 @@ String[1] $version, - # This parameter exists to enable the use case of running pe_xl::upgrade over + # This parameter exists to enable the use case of running peadm::upgrade over # the PCP transport. An orchestrator restart happens during provision # replica. Running `bolt plan run` directly on the master and using local # transport for that node will let the plan to run to completion without @@ -27,11 +27,11 @@ $ha_replica_target = [ $master_replica_host, - ].pe_xl::flatten_compact() + ].peadm::flatten_compact() $ha_database_target = [ $puppetdb_database_replica_host, - ].pe_xl::flatten_compact() + ].peadm::flatten_compact() # Look up which hosts are compilers in the stack # We look up groups of CMs separately since when they are upgraded is determined @@ -59,10 +59,10 @@ $puppetdb_database_replica_host, $compiler_cluster_master_hosts, $compiler_cluster_master_replica_hosts, - ].pe_xl::flatten_compact() + ].peadm::flatten_compact() # We need to make sure we aren't using PCP as this will go down during the upgrade - $all_hosts.pe_xl::fail_on_transport('pcp') + $all_hosts.peadm::fail_on_transport('pcp') # TODO: Do we need to update the pe.conf(s) with a console password? @@ -73,9 +73,9 @@ $master_target, $puppetdb_database_host, $puppetdb_database_replica_host, - ].pe_xl::flatten_compact() + ].peadm::flatten_compact() - run_task('pe_xl::download', $download_hosts, + run_task('peadm::download', $download_hosts, source => $pe_source, path => $upload_tarball_path, ) @@ -103,17 +103,17 @@ # TODO: Firewall up the master - run_task('pe_xl::pe_install', $master_target, + run_task('peadm::pe_install', $master_target, tarball => $upload_tarball_path, ) # Upgrade the master PuppetDB PostgreSQL host. Note that installer-driven # upgrade will de-configure auth access for compilers. Re-run Puppet # immediately to fully re-enable - run_task('pe_xl::pe_install', $puppetdb_database_host, + run_task('peadm::pe_install', $puppetdb_database_host, tarball => $upload_tarball_path, ) - run_task('pe_xl::puppet_runonce', $puppetdb_database_host) + run_task('peadm::puppet_runonce', $puppetdb_database_host) # Stop PuppetDB on the master run_task('service', $master_target, @@ -132,10 +132,10 @@ # TODO: Remove remaining firewall blocks # Wait until orchestrator service is healthy to proceed - run_task('pe_xl::orchestrator_healthcheck', $master_target) + run_task('peadm::orchestrator_healthcheck', $master_target) # Upgrade the compiler group A hosts - run_task('pe_xl::agent_upgrade', $compiler_cluster_master_hosts, + run_task('peadm::agent_upgrade', $compiler_cluster_master_hosts, server => $master_host, ) @@ -146,18 +146,18 @@ ) # Run the upgrade.sh script on the master replica host - run_task('pe_xl::agent_upgrade', $ha_replica_target, + run_task('peadm::agent_upgrade', $ha_replica_target, server => $master_host, ) # Upgrade the master replica's PuppetDB PostgreSQL host - run_task('pe_xl::pe_install', $ha_database_target, + run_task('peadm::pe_install', $ha_database_target, tarball => $upload_tarball_path, ) - run_task('pe_xl::puppet_runonce', $ha_database_target) + run_task('peadm::puppet_runonce', $ha_database_target) # Upgrade the compiler group B hosts - run_task('pe_xl::agent_upgrade', $compiler_cluster_master_replica_hosts, + run_task('peadm::agent_upgrade', $compiler_cluster_master_replica_hosts, server => $master_host, ) diff --git a/plans/util/retrieve_and_upload.pp b/plans/util/retrieve_and_upload.pp index 4acac8bb..4f76fcde 100644 --- a/plans/util/retrieve_and_upload.pp +++ b/plans/util/retrieve_and_upload.pp @@ -1,4 +1,4 @@ -plan pe_xl::util::retrieve_and_upload( +plan peadm::util::retrieve_and_upload( TargetSpec $nodes, String[1] $source, String[1] $local_path, @@ -11,17 +11,17 @@ } unless $exists { - run_task('pe_xl::download', 'local://localhost', + run_task('peadm::download', 'local://localhost', source => $source, path => $local_path, ) } - $local_size = run_task('pe_xl::filesize', 'local://localhost', + $local_size = run_task('peadm::filesize', 'local://localhost', path => $local_path, ).first['size'] - $targets_needing_file = run_task('pe_xl::filesize', $nodes, + $targets_needing_file = run_task('peadm::filesize', $nodes, path => $upload_path, ).filter |$result| { $result['size'] != $local_size diff --git a/types/pem.pp b/types/pem.pp index 68c0a071..c073e33a 100644 --- a/types/pem.pp +++ b/types/pem.pp @@ -1 +1 @@ -type Pe_xl::Pem = Pattern[/^-----BEGIN/] +type Peadm::Pem = Pattern[/^-----BEGIN/] diff --git a/types/singletargetspec.pp b/types/singletargetspec.pp index 877ed6b2..9f4b1d72 100644 --- a/types/singletargetspec.pp +++ b/types/singletargetspec.pp @@ -3,6 +3,8 @@ # Array[Target, 1, 1]. This is a constrained type variant of # Boltlib::TargetSpec for use when a _single_ target is valid, but multiple # targets are not. -type Pe_xl::SingleTargetSpec = Variant[Pattern[/\A[^[:space:],]+\z/], - Target, - Array[Boltlib::SingleTargetSpec, 1, 1]] +type Peadm::SingleTargetSpec = Variant[ + Pattern[/\A[^[:space:],]+\z/], + Target, + Array[Boltlib::SingleTargetSpec, 1, 1] +]