Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 53e8f57

Browse files
committedJan 18, 2020
Add support for Ubuntu platform
Or at least, enough support to try it out.
1 parent 9fd519e commit 53e8f57

File tree

6 files changed

+41
-18
lines changed

6 files changed

+41
-18
lines changed
 

Diff for: ‎documentation/basic_usage.md

+10
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,13 @@ Example params.json Bolt parameters file:
7474
"version": "2019.1.1"
7575
}
7676
```
77+
78+
## Offline usage
79+
80+
The peadm::provision 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::provision will not try to download it.
81+
82+
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::provision plan.
83+
84+
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`.
85+
86+
Installation content can be downloaded from [https://puppet.com/try-puppet/puppet-enterprise/download/](https://puppet.com/try-puppet/puppet-enterprise/download/).

Diff for: ‎plans/action/install.pp

+10-4
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,18 @@
106106
},
107107
}
108108

109+
$precheck_results = run_task('peadm::precheck', $all_targets)
110+
$platform = $precheck_results.first['platform'] # Assume the platform of the first result correct
111+
109112
# Validate that the name given for each system is both a resolvable name AND
110-
# the configured hostname.
111-
run_task('peadm::hostname', $all_targets).each |$result| {
113+
# the configured hostname, and that all systems return the same platform
114+
$precheck_results.each |$result| {
112115
if $result.target.name != $result['hostname'] {
113116
fail_plan("Hostname / DNS name mismatch: target ${result.target.name} reports '${result['hostname']}'")
114117
}
118+
if $result['platform'] != $platform {
119+
fail_plan("Platform mismatch: target ${result.target.name} reports '${result['platform']}; expected ${platform}'")
120+
}
115121
}
116122

117123
# Generate all the needed pe.conf files
@@ -143,12 +149,12 @@
143149
peadm::file_content_upload($puppetdb_database_replica_pe_conf, '/tmp/pe.conf', $puppetdb_database_replica_target)
144150

145151
# Download the PE tarball and send it to the nodes that need it
146-
$pe_tarball_name = "puppet-enterprise-${version}-el-7-x86_64.tar.gz"
152+
$pe_tarball_name = "puppet-enterprise-${version}-${platform}-x86_64.tar.gz"
147153
$local_tarball_path = "${stagingdir}/${pe_tarball_name}"
148154
$upload_tarball_path = "/tmp/${pe_tarball_name}"
149155

150156
run_plan('peadm::util::retrieve_and_upload', $pe_installer_targets,
151-
source => "https://s3.amazonaws.com/pe-builds/released/${version}/puppet-enterprise-${version}-el-7-x86_64.tar.gz",
157+
source => "https://s3.amazonaws.com/pe-builds/released/${version}/puppet-enterprise-${version}-${platform}-x86_64.tar.gz",
152158
local_path => $local_tarball_path,
153159
upload_path => $upload_tarball_path,
154160
)

Diff for: ‎tasks/hostname.json

-8
This file was deleted.

Diff for: ‎tasks/hostname.sh

-6
This file was deleted.

Diff for: ‎tasks/precheck.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"description": "Return pre-check information about a system",
3+
"parameters": { },
4+
"input_method": "environment",
5+
"implementations": [
6+
{"name": "precheck.sh"}
7+
]
8+
}

Diff for: ‎tasks/precheck.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
hostname=$(/usr/bin/hostname -f)
4+
osfamily=$(cat /etc/os-release | grep -qi ubuntu && echo "ubuntu" || echo "el")
5+
version=$(grep VERSION_ID /etc/os-release | cut -d '"' -f 2)
6+
7+
# Output a JSON result for ease of Task usage in Puppet Task Plans
8+
cat <<EOS
9+
{
10+
"hostname": "${hostname}",
11+
"platform": "${osfamily}-${version}"
12+
}
13+
EOS

0 commit comments

Comments
 (0)
Please sign in to comment.