Skip to content

Commit 5ad16dd

Browse files
committed
support configurable installer target upload path
Upload path was hard-coded to /tmp. Very large files can be problematic as it is memory backed and typically not limited by default. With ~1.4G used by the PE installer, unexpected bolt failures on systems with low to no swap occur (high performance or containers).
1 parent 97ec11b commit 5ad16dd

File tree

6 files changed

+65
-25
lines changed

6 files changed

+65
-25
lines changed

REFERENCE.md

+40-18
Original file line numberDiff line numberDiff line change
@@ -1535,6 +1535,8 @@ The following parameters are available in the `peadm::install` plan:
15351535
* [`pe_installer_source`](#-peadm--install--pe_installer_source)
15361536
* [`ldap_config`](#-peadm--install--ldap_config)
15371537
* [`final_agent_state`](#-peadm--install--final_agent_state)
1538+
* [`stagingdir`](#-peadm--install--stagingdir)
1539+
* [`uploaddir`](#-peadm--install--uploaddir)
15381540
* [`primary_host`](#-peadm--install--primary_host)
15391541
* [`replica_host`](#-peadm--install--replica_host)
15401542
* [`compiler_hosts`](#-peadm--install--compiler_hosts)
@@ -1551,7 +1553,6 @@ The following parameters are available in the `peadm::install` plan:
15511553
* [`deploy_environment`](#-peadm--install--deploy_environment)
15521554
* [`license_key_file`](#-peadm--install--license_key_file)
15531555
* [`license_key_content`](#-peadm--install--license_key_content)
1554-
* [`stagingdir`](#-peadm--install--stagingdir)
15551556
* [`download_mode`](#-peadm--install--download_mode)
15561557
* [`permit_unsafe_versions`](#-peadm--install--permit_unsafe_versions)
15571558
* [`token_lifetime`](#-peadm--install--token_lifetime)
@@ -1616,6 +1617,24 @@ after PE is configured successfully.
16161617

16171618
Default value: `'running'`
16181619

1620+
##### <a name="-peadm--install--stagingdir"></a>`stagingdir`
1621+
1622+
Data type: `Optional[String]`
1623+
1624+
Directory on the Bolt host where the installer tarball will be cached if
1625+
download_mode is 'bolthost' (default)
1626+
1627+
Default value: `undef`
1628+
1629+
##### <a name="-peadm--install--uploaddir"></a>`uploaddir`
1630+
1631+
Data type: `Optional[String]`
1632+
1633+
Directory the installer tarball will be uploaded to or expected to be in
1634+
for offline usage.
1635+
1636+
Default value: `undef`
1637+
16191638
##### <a name="-peadm--install--primary_host"></a>`primary_host`
16201639

16211640
Data type: `Peadm::SingleTargetSpec`
@@ -1738,14 +1757,6 @@ Data type: `Optional[String]`
17381757

17391758

17401759

1741-
Default value: `undef`
1742-
1743-
##### <a name="-peadm--install--stagingdir"></a>`stagingdir`
1744-
1745-
Data type: `Optional[String]`
1746-
1747-
1748-
17491760
Default value: `undef`
17501761

17511762
##### <a name="-peadm--install--download_mode"></a>`download_mode`
@@ -1905,14 +1916,15 @@ The following parameters are available in the `peadm::upgrade` plan:
19051916
* [`internal_compiler_b_pool_address`](#-peadm--upgrade--internal_compiler_b_pool_address)
19061917
* [`pe_installer_source`](#-peadm--upgrade--pe_installer_source)
19071918
* [`final_agent_state`](#-peadm--upgrade--final_agent_state)
1919+
* [`stagingdir`](#-peadm--upgrade--stagingdir)
1920+
* [`uploaddir`](#-peadm--upgrade--uploaddir)
19081921
* [`primary_host`](#-peadm--upgrade--primary_host)
19091922
* [`replica_host`](#-peadm--upgrade--replica_host)
19101923
* [`compiler_hosts`](#-peadm--upgrade--compiler_hosts)
19111924
* [`primary_postgresql_host`](#-peadm--upgrade--primary_postgresql_host)
19121925
* [`replica_postgresql_host`](#-peadm--upgrade--replica_postgresql_host)
19131926
* [`version`](#-peadm--upgrade--version)
19141927
* [`token_file`](#-peadm--upgrade--token_file)
1915-
* [`stagingdir`](#-peadm--upgrade--stagingdir)
19161928
* [`download_mode`](#-peadm--upgrade--download_mode)
19171929
* [`permit_unsafe_versions`](#-peadm--upgrade--permit_unsafe_versions)
19181930
* [`begin_at_step`](#-peadm--upgrade--begin_at_step)
@@ -1966,6 +1978,24 @@ after PE is upgraded successfully.
19661978

19671979
Default value: `'running'`
19681980

1981+
##### <a name="-peadm--upgrade--stagingdir"></a>`stagingdir`
1982+
1983+
Data type: `String`
1984+
1985+
Directory on the Bolt host where the installer tarball will be cached if
1986+
download_mode is 'bolthost' (default)
1987+
1988+
Default value: `'/tmp'`
1989+
1990+
##### <a name="-peadm--upgrade--uploaddir"></a>`uploaddir`
1991+
1992+
Data type: `String`
1993+
1994+
Directory the installer tarball will be uploaded to or expected to be in
1995+
for offline usage.
1996+
1997+
Default value: `'/tmp'`
1998+
19691999
##### <a name="-peadm--upgrade--primary_host"></a>`primary_host`
19702000

19712001
Data type: `Peadm::SingleTargetSpec`
@@ -2020,14 +2050,6 @@ Data type: `Optional[String]`
20202050

20212051
Default value: `undef`
20222052

2023-
##### <a name="-peadm--upgrade--stagingdir"></a>`stagingdir`
2024-
2025-
Data type: `String`
2026-
2027-
2028-
2029-
Default value: `'/tmp'`
2030-
20312053
##### <a name="-peadm--upgrade--download_mode"></a>`download_mode`
20322054

20332055
Data type: `Enum[direct,bolthost]`

documentation/install.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -119,24 +119,25 @@ Example params.json Bolt parameters file (shown: Standard):
119119
}
120120
```
121121

122-
Review the [peadm::install plan](../plans/install.pp) to learn about more advanced installation options. For example, it is possible to: supply an ssh private key and git clone URL for a control-repo as part of installation; supply the LDAP configuration data for PE; and similar complete automation tie-ins.
122+
Review the [peadm::install plan](../plans/install.pp) to learn about more advanced installation options. For example, it is possible to: supply an ssh private key and git clone URL for a control-repo as part of installation; supply the LDAP configuration data for PE; specify where the installer tarball is uploaded; and similar complete automation tie-ins.
123123

124124
## Offline usage
125125

126-
The peadm::install plan downloads installation content from an online repository by default. To perform an offline installation, you can prefetch the needed content and place it in the staging directory. If content is available in the staging directory, peadm::install will not try to download it.
126+
The peadm::install plan downloads installation content from an online repository by default. To perform an offline installation, you can prefetch the needed content and place it in the staging directory on the Bolt host. If content is available in the staging directory, peadm::install will not try to download it.
127127

128128
The default staging directory is `/tmp`. If a different staging dir is being used, it can be specified using the `stagingdir` parameter to the peadm::install plan.
129129

130130
The content needed is the PE installation tarball for the target version. The installation content should be in the staging dir, and should have its original name. E.g. `/tmp/puppet-enterprise-2021.4.0-el-7-x86_64.tar.gz`.
131131

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

134-
If you wish to prevent the bolt host from transferring the installer tarball to the targets you can place the installer tar files on the target hosts in the staging directory. This can save time over slow networks, but is best to just perform the bolt task on the target node (puppetserver). The tar file will need to exist in the staging directory for the following configuration:
134+
If you wish to prevent the bolt host from transferring the installer tarball to the targets you can place the installer tar files on the target hosts in the _upload directory_. This can save time over slow networks, but is best to just perform the bolt task on the target node (puppetserver). The default _upload directory_ is `/tmp`. If a different upload dir is being used, it can be specified using the `uploaddir` parameter to the peadm::install plan. With default parameters the tar file will need to exist in the directories for offline configuration:
135135

136136
* /tmp on the Bolt host
137137
* /tmp on the primary
138138
* /tmp on the primary PuppetDB PostgreSQL (if used)
139139
* /tmp on the replica PuppetDB PostgreSQL (if used)
140+
140141
## Online usage
141142

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

documentation/upgrade.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,16 @@ bolt plan run peadm::upgrade --params @params.json
3232

3333
## Offline Usage
3434

35-
The `peadm::upgrade` plan downloads installation content from an online repository by default. To perform an offline installation, you can prefetch the needed content and place it in the staging directory. If content is available in the staging directory, `peadm::upgrade` will not try to download it.
35+
The `peadm::upgrade` plan downloads installation content from an online repository by default. To perform an offline installation, you can prefetch the needed content and place it in the staging directory on the Bolt host. If content is available in the staging directory, `peadm::upgrade` will not try to download it.
3636

3737
The default staging directory is `/tmp`. If a different staging dir is being used, it can be specified using the `stagingdir` parameter to the peadm::upgrade plan.
3838

3939
The content needed is the PE installation tarball for the target version. The installation content should be in the staging dir, and should have its original name. E.g. `/tmp/puppet-enterprise-2019.2.2-el-7-x86_64.tar.gz`.
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+
If you wish to prevent the bolt host from transferring the installer tarball to the targets you can place the installer tar files on the target hosts in the _upload directory_. This can save time over slow networks, but is best to just perform the bolt task on the target node (puppetserver). The default _upload directory_ is `/tmp`. If a different upload dir is being used, it can be specified using the `uploaddir` parameter to the peadm::upgrade plan.
44+
4345
Note if `pe_repo` classes have been declared (for agents with different OS/platform than your primary server - see [Install \*nix agents with PE package management](https://www.puppet.com/docs/pe/2021.7/installing_nix_agents.html#install_nix_agents_pe_package_management)), you must also stage the agent repo tarballs for the new PE version before running the `peadm::upgrade` plan, otherwise the plan will fail when it runs puppet to complete the upgrade, as it will not be able to download the agent repos from the internet.
4446

4547
See [Upgrade agents without internet access](https://www.puppet.com/docs/pe/2021.7/upgrading_agents.html#upgrade_agents_without_internet_access) for the location of the agent staging directory on the primary server. From the **Puppet Release Information & Downloads** page linked in the agent upgrade documentation, select the required PE version and navigate to the **Agent Repos** section to download the corresponding agent repo tarball. Ensure the files are prefetched/downloaded from the correct section - the agent repo staging directory expects the agent ___repo___ tarballs (`.tar.gz`), NOT the agent package downloads available from the same page.

plans/install.pp

+8
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
# @param final_agent_state
2525
# Configures the state the puppet agent should be in on infrastructure nodes
2626
# after PE is configured successfully.
27+
# @param stagingdir
28+
# Directory on the Bolt host where the installer tarball will be cached if
29+
# download_mode is 'bolthost' (default)
30+
# @param uploaddir
31+
# Directory the installer tarball will be uploaded to or expected to be in
32+
# for offline usage.
2733
#
2834
plan peadm::install (
2935
# Standard
@@ -61,6 +67,7 @@
6167

6268
# Other
6369
Optional[String] $stagingdir = undef,
70+
Optional[String] $uploaddir = undef,
6471
Enum['running', 'stopped'] $final_agent_state = 'running',
6572
Enum['direct', 'bolthost'] $download_mode = 'bolthost',
6673
Boolean $permit_unsafe_versions = false,
@@ -101,6 +108,7 @@
101108

102109
# Other
103110
stagingdir => $stagingdir,
111+
uploaddir => $uploaddir,
104112
download_mode => $download_mode,
105113
permit_unsafe_versions => $permit_unsafe_versions,
106114
token_lifetime => $token_lifetime,

plans/subplans/install.pp

+2-1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757

5858
# Other
5959
String $stagingdir = '/tmp',
60+
String $uploaddir = '/tmp',
6061
Enum[direct,bolthost] $download_mode = 'bolthost',
6162
Boolean $permit_unsafe_versions = false,
6263
String $token_lifetime = '1y',
@@ -211,7 +212,7 @@
211212
$pe_tarball_source = "https://s3.amazonaws.com/pe-builds/released/${version}/${pe_tarball_name}"
212213
}
213214

214-
$upload_tarball_path = "/tmp/${pe_tarball_name}"
215+
$upload_tarball_path = "${uploaddir}/${pe_tarball_name}"
215216

216217
if $download_mode == 'bolthost' {
217218
# Download the PE tarball and send it to the nodes that need it

plans/upgrade.pp

+8-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@
1919
# @param final_agent_state
2020
# Configures the state the puppet agent should be in on infrastructure nodes
2121
# after PE is upgraded successfully.
22-
#
22+
# @param stagingdir
23+
# Directory on the Bolt host where the installer tarball will be cached if
24+
# download_mode is 'bolthost' (default)
25+
# @param uploaddir
26+
# Directory the installer tarball will be uploaded to or expected to be in
27+
# for offline usage.
2328
plan peadm::upgrade (
2429
# Standard
2530
Peadm::SingleTargetSpec $primary_host,
@@ -42,6 +47,7 @@
4247
# Other
4348
Optional[String] $token_file = undef,
4449
String $stagingdir = '/tmp',
50+
String $uploaddir = '/tmp',
4551
Enum['running', 'stopped'] $final_agent_state = 'running',
4652
Enum[direct,bolthost] $download_mode = 'bolthost',
4753
Boolean $permit_unsafe_versions = false,
@@ -112,7 +118,7 @@
112118
$pe_tarball_source = "https://s3.amazonaws.com/pe-builds/released/${_version}/${pe_tarball_name}"
113119
}
114120

115-
$upload_tarball_path = "/tmp/${pe_tarball_name}"
121+
$upload_tarball_path = "${uploaddir}/${pe_tarball_name}"
116122

117123
peadm::assert_supported_bolt_version()
118124

0 commit comments

Comments
 (0)