Skip to content

Commit 9c74a7f

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 64a73ac commit 9c74a7f

File tree

6 files changed

+66
-25
lines changed

6 files changed

+66
-25
lines changed

REFERENCE.md

+40-18
Original file line numberDiff line numberDiff line change
@@ -1648,6 +1648,8 @@ The following parameters are available in the `peadm::install` plan:
16481648
* [`pe_installer_source`](#-peadm--install--pe_installer_source)
16491649
* [`ldap_config`](#-peadm--install--ldap_config)
16501650
* [`final_agent_state`](#-peadm--install--final_agent_state)
1651+
* [`stagingdir`](#-peadm--install--stagingdir)
1652+
* [`uploaddir`](#-peadm--install--uploaddir)
16511653
* [`primary_host`](#-peadm--install--primary_host)
16521654
* [`replica_host`](#-peadm--install--replica_host)
16531655
* [`compiler_hosts`](#-peadm--install--compiler_hosts)
@@ -1665,7 +1667,6 @@ The following parameters are available in the `peadm::install` plan:
16651667
* [`deploy_environment`](#-peadm--install--deploy_environment)
16661668
* [`license_key_file`](#-peadm--install--license_key_file)
16671669
* [`license_key_content`](#-peadm--install--license_key_content)
1668-
* [`stagingdir`](#-peadm--install--stagingdir)
16691670
* [`download_mode`](#-peadm--install--download_mode)
16701671
* [`permit_unsafe_versions`](#-peadm--install--permit_unsafe_versions)
16711672
* [`token_lifetime`](#-peadm--install--token_lifetime)
@@ -1730,6 +1731,24 @@ after PE is configured successfully.
17301731

17311732
Default value: `'running'`
17321733

1734+
##### <a name="-peadm--install--stagingdir"></a>`stagingdir`
1735+
1736+
Data type: `Optional[String]`
1737+
1738+
Directory on the Bolt host where the installer tarball will be cached if
1739+
download_mode is 'bolthost' (default)
1740+
1741+
Default value: `undef`
1742+
1743+
##### <a name="-peadm--install--uploaddir"></a>`uploaddir`
1744+
1745+
Data type: `Optional[String]`
1746+
1747+
Directory the installer tarball will be uploaded to or expected to be in
1748+
for offline usage.
1749+
1750+
Default value: `undef`
1751+
17331752
##### <a name="-peadm--install--primary_host"></a>`primary_host`
17341753

17351754
Data type: `Peadm::SingleTargetSpec`
@@ -1860,14 +1879,6 @@ Data type: `Optional[String]`
18601879

18611880

18621881

1863-
Default value: `undef`
1864-
1865-
##### <a name="-peadm--install--stagingdir"></a>`stagingdir`
1866-
1867-
Data type: `Optional[String]`
1868-
1869-
1870-
18711882
Default value: `undef`
18721883

18731884
##### <a name="-peadm--install--download_mode"></a>`download_mode`
@@ -2028,14 +2039,15 @@ The following parameters are available in the `peadm::upgrade` plan:
20282039
* [`pe_installer_source`](#-peadm--upgrade--pe_installer_source)
20292040
* [`final_agent_state`](#-peadm--upgrade--final_agent_state)
20302041
* [`r10k_known_hosts`](#-peadm--upgrade--r10k_known_hosts)
2042+
* [`stagingdir`](#-peadm--upgrade--stagingdir)
2043+
* [`uploaddir`](#-peadm--upgrade--uploaddir)
20312044
* [`primary_host`](#-peadm--upgrade--primary_host)
20322045
* [`replica_host`](#-peadm--upgrade--replica_host)
20332046
* [`compiler_hosts`](#-peadm--upgrade--compiler_hosts)
20342047
* [`primary_postgresql_host`](#-peadm--upgrade--primary_postgresql_host)
20352048
* [`replica_postgresql_host`](#-peadm--upgrade--replica_postgresql_host)
20362049
* [`version`](#-peadm--upgrade--version)
20372050
* [`token_file`](#-peadm--upgrade--token_file)
2038-
* [`stagingdir`](#-peadm--upgrade--stagingdir)
20392051
* [`download_mode`](#-peadm--upgrade--download_mode)
20402052
* [`permit_unsafe_versions`](#-peadm--upgrade--permit_unsafe_versions)
20412053
* [`begin_at_step`](#-peadm--upgrade--begin_at_step)
@@ -2100,6 +2112,24 @@ information for hostname, key-type and public key.
21002112

21012113
Default value: `undef`
21022114

2115+
##### <a name="-peadm--upgrade--stagingdir"></a>`stagingdir`
2116+
2117+
Data type: `String`
2118+
2119+
Directory on the Bolt host where the installer tarball will be cached if
2120+
download_mode is 'bolthost' (default)
2121+
2122+
Default value: `'/tmp'`
2123+
2124+
##### <a name="-peadm--upgrade--uploaddir"></a>`uploaddir`
2125+
2126+
Data type: `String`
2127+
2128+
Directory the installer tarball will be uploaded to or expected to be in
2129+
for offline usage.
2130+
2131+
Default value: `'/tmp'`
2132+
21032133
##### <a name="-peadm--upgrade--primary_host"></a>`primary_host`
21042134

21052135
Data type: `Peadm::SingleTargetSpec`
@@ -2154,14 +2184,6 @@ Data type: `Optional[String]`
21542184

21552185
Default value: `undef`
21562186

2157-
##### <a name="-peadm--upgrade--stagingdir"></a>`stagingdir`
2158-
2159-
Data type: `String`
2160-
2161-
2162-
2163-
Default value: `'/tmp'`
2164-
21652187
##### <a name="-peadm--upgrade--download_mode"></a>`download_mode`
21662188

21672189
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
@@ -38,14 +38,16 @@ bolt plan run peadm::upgrade --params @params.json
3838

3939
## Offline Usage
4040

41-
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.
41+
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.
4242

4343
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.
4444

4545
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`.
4646

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

49+
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.
50+
4951
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.
5052

5153
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
@@ -62,6 +68,7 @@
6268

6369
# Other
6470
Optional[String] $stagingdir = undef,
71+
Optional[String] $uploaddir = undef,
6572
Enum['running', 'stopped'] $final_agent_state = 'running',
6673
Enum['direct', 'bolthost'] $download_mode = 'bolthost',
6774
Boolean $permit_unsafe_versions = false,
@@ -103,6 +110,7 @@
103110

104111
# Other
105112
stagingdir => $stagingdir,
113+
uploaddir => $uploaddir,
106114
download_mode => $download_mode,
107115
permit_unsafe_versions => $permit_unsafe_versions,
108116
token_lifetime => $token_lifetime,

plans/subplans/install.pp

+2-1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666

6767
# Other
6868
String $stagingdir = '/tmp',
69+
String $uploaddir = '/tmp',
6970
Enum[direct,bolthost] $download_mode = 'bolthost',
7071
Boolean $permit_unsafe_versions = false,
7172
String $token_lifetime = '1y',
@@ -221,7 +222,7 @@
221222
$pe_tarball_source = "https://s3.amazonaws.com/pe-builds/released/${version}/${pe_tarball_name}"
222223
}
223224

224-
$upload_tarball_path = "/tmp/${pe_tarball_name}"
225+
$upload_tarball_path = "${uploaddir}/${pe_tarball_name}"
225226

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

plans/upgrade.pp

+9-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,13 @@
2424
# r10k_remote host when using ssh. you must provide \$r10k_known_hosts
2525
# information in the form of an array of hashes with 'name', 'type' and 'key'
2626
# information for hostname, key-type and public key.
27-
#
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.
33+
#
2834
plan peadm::upgrade (
2935
# Standard
3036
Peadm::SingleTargetSpec $primary_host,
@@ -48,6 +54,7 @@
4854
# Other
4955
Optional[String] $token_file = undef,
5056
String $stagingdir = '/tmp',
57+
String $uploaddir = '/tmp',
5158
Enum['running', 'stopped'] $final_agent_state = 'running',
5259
Enum[direct,bolthost] $download_mode = 'bolthost',
5360
Boolean $permit_unsafe_versions = false,
@@ -120,7 +127,7 @@
120127
$pe_tarball_source = "https://s3.amazonaws.com/pe-builds/released/${_version}/${pe_tarball_name}"
121128
}
122129

123-
$upload_tarball_path = "/tmp/${pe_tarball_name}"
130+
$upload_tarball_path = "${uploaddir}/${pe_tarball_name}"
124131

125132
peadm::assert_supported_bolt_version()
126133

0 commit comments

Comments
 (0)