Skip to content

Add direct download option for PE installers #97

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions documentation/provision.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ The content needed is the PE installation tarball for the target version. The in

Installation content can be downloaded from [https://puppet.com/try-puppet/puppet-enterprise/download/](https://puppet.com/try-puppet/puppet-enterprise/download/).

## Online usage

The peadm::provision plan can be configured to download installation content directly to hosts. To configure online installation, set the `download_mode` parameter of the `peadm::provision` plan to `direct`. The direct mode is often more efficient when PE hosts have a route to the internet.

## Hostnames and Certificate Names

The various host parameters given to the peadm::provision or peadm::action::install plans will be set as Puppet certificate names. You must use the names here that you want the servers to be identified as by Puppet.
Expand Down
4 changes: 4 additions & 0 deletions documentation/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ The content needed is the PE installation tarball for the target version. The in

Installation content can be downloaded from [https://puppet.com/try-puppet/puppet-enterprise/download/](https://puppet.com/try-puppet/puppet-enterprise/download/).

## Online usage

The peadm::provision plan can be configured to download installation content directly to hosts. To configure online installation, set the `download_mode` parameter of the `peadm::provision` plan to `direct`. The direct mode is often more efficient when PE hosts have a route to the internet.

## Usage over the Orchestrator transport

The peadm::upgrade plan can be used with the Orchestrator (pcp) transport, provided that the Bolt executor is running as root on the master. To use the Orchestrator transport prepare an inventory file such as the following to set the default transport to be `pcp`, but the master specifically to be `local`.
Expand Down
25 changes: 17 additions & 8 deletions plans/action/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
Optional[String] $license_key_content = undef,

# Other
String $stagingdir = '/tmp',
String $stagingdir = '/tmp',
Enum[direct,bolthost] $download_mode = 'bolthost',
) {
# Convert inputs into targets.
$master_target = peadm::get_targets($master_host, 1)
Expand Down Expand Up @@ -168,16 +169,24 @@
)
}

# Download the PE tarball and send it to the nodes that need it
$pe_tarball_name = "puppet-enterprise-${version}-${platform}.tar.gz"
$local_tarball_path = "${stagingdir}/${pe_tarball_name}"
$pe_tarball_source = "https://s3.amazonaws.com/pe-builds/released/${version}/${pe_tarball_name}"
$upload_tarball_path = "/tmp/${pe_tarball_name}"

run_plan('peadm::util::retrieve_and_upload', $pe_installer_targets,
source => "https://s3.amazonaws.com/pe-builds/released/${version}/puppet-enterprise-${version}-${platform}.tar.gz",
local_path => $local_tarball_path,
upload_path => $upload_tarball_path,
)
if $download_mode == 'bolthost' {
# Download the PE tarball and send it to the nodes that need it
run_plan('peadm::util::retrieve_and_upload', $pe_installer_targets,
source => $pe_tarball_source,
local_path => "${stagingdir}/${pe_tarball_name}",
upload_path => $upload_tarball_path,
)
} else {
# Download PE tarballs directly to nodes that need it
run_task('peadm::download', $pe_installer_targets,
source => $pe_tarball_source,
path => $upload_tarball_path,
)
}

# Create csr_attributes.yaml files for the nodes that need them. Ensure that
# if a csr_attributes.yaml file is already present, the values we need are
Expand Down
4 changes: 3 additions & 1 deletion plans/provision.pp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
Optional[String] $license_key_content = undef,

# Other
Optional[String] $stagingdir = undef,
Optional[String] $stagingdir = undef,
Enum[direct,bolthost] $download_mode = 'bolthost',
) {

$install_result = run_plan('peadm::action::install',
Expand Down Expand Up @@ -64,6 +65,7 @@

# Other
stagingdir => $stagingdir,
download_mode => $download_mode,
)

$configure_result = run_plan('peadm::action::configure',
Expand Down
24 changes: 17 additions & 7 deletions plans/upgrade.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
String $version,

# Other
String[1] $stagingdir = '/tmp',
String $stagingdir = '/tmp',
Enum[direct,bolthost] $download_mode = 'bolthost',
) {
# Ensure input valid for a supported architecture
$arch = peadm::validate_architecture(
Expand Down Expand Up @@ -82,16 +83,25 @@
# if the orchestrator is being used for the master.
$master_target.peadm::fail_on_transport('pcp')

# Download the PE tarball on the nodes that need it
$platform = run_task('peadm::precheck', $master_target).first['platform']
$tarball_filename = "puppet-enterprise-${version}-${platform}.tar.gz"
$tarball_source = "https://s3.amazonaws.com/pe-builds/released/${version}/${tarball_filename}"
$upload_tarball_path = "/tmp/${tarball_filename}"

run_plan('peadm::util::retrieve_and_upload', $pe_installer_targets,
source => "https://s3.amazonaws.com/pe-builds/released/${version}/${tarball_filename}",
local_path => "${stagingdir}/${tarball_filename}",
upload_path => $upload_tarball_path,
)
if $download_mode == 'bolthost' {
# Download the PE tarball on the nodes that need it
run_plan('peadm::util::retrieve_and_upload', $pe_installer_targets,
source => $tarball_source,
local_path => "${stagingdir}/${tarball_filename}",
upload_path => $upload_tarball_path,
)
} else {
# Download PE tarballs directly to nodes that need it
run_task('peadm::download', $pe_installer_targets,
source => $tarball_source,
path => $upload_tarball_path,
)
}

# Shut down Puppet on all infra targets
run_task('service', $all_targets,
Expand Down