Skip to content

Commit 6a415d5

Browse files
authored
Merge pull request #97 from Sharpie/add-direct-download-option
Add direct download option for PE installers
2 parents 1622d61 + ffb601b commit 6a415d5

File tree

5 files changed

+45
-16
lines changed

5 files changed

+45
-16
lines changed

documentation/provision.md

+4
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ The content needed is the PE installation tarball for the target version. The in
103103

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

106+
## Online usage
107+
108+
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.
109+
106110
## Hostnames and Certificate Names
107111

108112
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.

documentation/upgrade.md

+4
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ The content needed is the PE installation tarball for the target version. The in
4040

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

43+
## Online usage
44+
45+
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.
46+
4347
## Usage over the Orchestrator transport
4448

4549
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`.

plans/action/install.pp

+17-8
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@
4646
Optional[String] $license_key_content = undef,
4747

4848
# Other
49-
String $stagingdir = '/tmp',
49+
String $stagingdir = '/tmp',
50+
Enum[direct,bolthost] $download_mode = 'bolthost',
5051
) {
5152
# Convert inputs into targets.
5253
$master_target = peadm::get_targets($master_host, 1)
@@ -168,16 +169,24 @@
168169
)
169170
}
170171

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

176-
run_plan('peadm::util::retrieve_and_upload', $pe_installer_targets,
177-
source => "https://s3.amazonaws.com/pe-builds/released/${version}/puppet-enterprise-${version}-${platform}.tar.gz",
178-
local_path => $local_tarball_path,
179-
upload_path => $upload_tarball_path,
180-
)
176+
if $download_mode == 'bolthost' {
177+
# Download the PE tarball and send it to the nodes that need it
178+
run_plan('peadm::util::retrieve_and_upload', $pe_installer_targets,
179+
source => $pe_tarball_source,
180+
local_path => "${stagingdir}/${pe_tarball_name}",
181+
upload_path => $upload_tarball_path,
182+
)
183+
} else {
184+
# Download PE tarballs directly to nodes that need it
185+
run_task('peadm::download', $pe_installer_targets,
186+
source => $pe_tarball_source,
187+
path => $upload_tarball_path,
188+
)
189+
}
181190

182191
# Create csr_attributes.yaml files for the nodes that need them. Ensure that
183192
# if a csr_attributes.yaml file is already present, the values we need are

plans/provision.pp

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
Optional[String] $license_key_content = undef,
3333

3434
# Other
35-
Optional[String] $stagingdir = undef,
35+
Optional[String] $stagingdir = undef,
36+
Enum[direct,bolthost] $download_mode = 'bolthost',
3637
) {
3738

3839
$install_result = run_plan('peadm::action::install',
@@ -64,6 +65,7 @@
6465

6566
# Other
6667
stagingdir => $stagingdir,
68+
download_mode => $download_mode,
6769
)
6870

6971
$configure_result = run_plan('peadm::action::configure',

plans/upgrade.pp

+17-7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
String $version,
1717

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

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

90-
run_plan('peadm::util::retrieve_and_upload', $pe_installer_targets,
91-
source => "https://s3.amazonaws.com/pe-builds/released/${version}/${tarball_filename}",
92-
local_path => "${stagingdir}/${tarball_filename}",
93-
upload_path => $upload_tarball_path,
94-
)
91+
if $download_mode == 'bolthost' {
92+
# Download the PE tarball on the nodes that need it
93+
run_plan('peadm::util::retrieve_and_upload', $pe_installer_targets,
94+
source => $tarball_source,
95+
local_path => "${stagingdir}/${tarball_filename}",
96+
upload_path => $upload_tarball_path,
97+
)
98+
} else {
99+
# Download PE tarballs directly to nodes that need it
100+
run_task('peadm::download', $pe_installer_targets,
101+
source => $tarball_source,
102+
path => $upload_tarball_path,
103+
)
104+
}
95105

96106
# Shut down Puppet on all infra targets
97107
run_task('service', $all_targets,

0 commit comments

Comments
 (0)