Skip to content

Commit 5b11f04

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 5b11f04

File tree

6 files changed

+43
-7
lines changed

6 files changed

+43
-7
lines changed

REFERENCE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1552,6 +1552,7 @@ The following parameters are available in the `peadm::install` plan:
15521552
* [`license_key_file`](#-peadm--install--license_key_file)
15531553
* [`license_key_content`](#-peadm--install--license_key_content)
15541554
* [`stagingdir`](#-peadm--install--stagingdir)
1555+
* [`uploaddir`](#-peadm--install--uploaddir)
15551556
* [`download_mode`](#-peadm--install--download_mode)
15561557
* [`permit_unsafe_versions`](#-peadm--install--permit_unsafe_versions)
15571558
* [`token_lifetime`](#-peadm--install--token_lifetime)
@@ -1746,6 +1747,14 @@ Data type: `Optional[String]`
17461747

17471748

17481749

1750+
Default value: `undef`
1751+
1752+
##### <a name="-peadm--install--uploaddir"></a>`uploaddir`
1753+
1754+
Data type: `Optional[String]`
1755+
1756+
1757+
17491758
Default value: `undef`
17501759

17511760
##### <a name="-peadm--install--download_mode"></a>`download_mode`
@@ -1913,6 +1922,7 @@ The following parameters are available in the `peadm::upgrade` plan:
19131922
* [`version`](#-peadm--upgrade--version)
19141923
* [`token_file`](#-peadm--upgrade--token_file)
19151924
* [`stagingdir`](#-peadm--upgrade--stagingdir)
1925+
* [`uploaddir`](#-peadm--upgrade--uploaddir)
19161926
* [`download_mode`](#-peadm--upgrade--download_mode)
19171927
* [`permit_unsafe_versions`](#-peadm--upgrade--permit_unsafe_versions)
19181928
* [`begin_at_step`](#-peadm--upgrade--begin_at_step)
@@ -2026,6 +2036,14 @@ Data type: `String`
20262036

20272037

20282038

2039+
Default value: `'/tmp'`
2040+
2041+
##### <a name="-peadm--upgrade--uploaddir"></a>`uploaddir`
2042+
2043+
Data type: `String`
2044+
2045+
2046+
20292047
Default value: `'/tmp'`
20302048

20312049
##### <a name="-peadm--upgrade--download_mode"></a>`download_mode`

documentation/install.md

Lines changed: 4 additions & 3 deletions
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

Lines changed: 3 additions & 1 deletion
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

Lines changed: 8 additions & 0 deletions
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 8 additions & 2 deletions
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)