Skip to content

Commit bd54b63

Browse files
authored
(SUP-1376) (SUP-1375) (#55)
* facts upload initial commit pre kb number assignment * initial commit pe download * kb0362 and kb 0362 * kb0362 and kb 0362 * 1.0.8 prep * shell check fix * shell check fixes * removed erroneous comment
1 parent b23f114 commit bd54b63

9 files changed

+112
-1
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,19 @@ Updated to PDK template version PDK 1.12
9191

9292
Updated Readme for missing links
9393

94+
95+
## Release 1.0.8
96+
97+
September 20th 2019
98+
99+
**Features**
100+
101+
Updated to PDK 1.13
102+
103+
New Tasks:
104+
105+
kb00362_download_latest_pe_in_stream
106+
kb00361b_uploading_facts
107+
kb00361a_uploading_facts
108+
109+

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ To view the available actions and parameters for each task, on the command line,
6262

6363
* [`kb0337_Check_and_fix_the_expiry_date_for_your_CA`](https://support.puppet.com/hc/en-us/articles/360022508353)
6464

65+
* [`KB#0361 Uploading facts to the Puppet master`](https://support.puppet.com/hc/en-us/articles/360036136533)
66+
67+
* [`KB#0362 Check for and download the latest patch for your current major release for Puppet Enterprise `](https://support.puppet.com/hc/en-us/articles/360036141593 )
68+
6569
## Getting Help
6670

6771
Puppet Enterprise Support customers can open a ticket with us at our portal for assistance <https://support.puppet.com/hc/en-us>, this module is officially supported by the Puppet Enterprise Support Team

metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "puppetlabs-support_tasks",
3-
"version": "1.0.7",
3+
"version": "1.0.8",
44
"author": "Puppet Support Team",
55
"summary": "A module used to deliver Tasks for the solutions & configurations described in the PE Support Knowledgebase https://support.puppet.com/hc/en-us",
66
"license": "Apache-2.0",

tasks/kb00361a_uploading_facts.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"puppet_task_version": 1,
3+
"supports_noop": false,
4+
"description": "KB0361 Uploading Facts To the Puppet Master Outside of a Puppet Run - This Task to be used in conjunction with Puppet Enterprise Knowledge Base Article KB0361 - https://support.puppet.com/hc/en-us/articles/360036136533",
5+
"parameters": {
6+
}
7+
}

tasks/kb00361a_uploading_facts.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
4+
/opt/puppetlabs/bin/puppet facts upload
5+
6+
echo "KB3061a Task ended $(date +%s) --"

tasks/kb00361b_uploading_facts.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"puppet_task_version": 1,
3+
"supports_noop": false,
4+
"description": "KB0361 Uploading Facts To the Puppet Master Outside of a Puppet Run - This Task to be used in conjunction with Puppet Enterprise Knowledge Base Article KB0361 - https://support.puppet.com/hc/en-us/articles/360036136533",
5+
"parameters": {
6+
}
7+
}

tasks/kb00361b_uploading_facts.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env powershell
2+
3+
C:\"Program Files"\"Puppet Labs"\Puppet\bin\puppet facts upload
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"puppet_task_version": 1,
3+
"supports_noop": false,
4+
"description": "KB0362 Download Latest PE Z release in the currently installed stream - This task to be used in conjunction with Puppet Enterprise Knowledge Base Article KB00362 - https://support.puppet.com/hc/en-us/articles/360036141593",
5+
"parameters": {
6+
"dlpath": {
7+
"description": "The Path to Download PE too",
8+
"type": "String"
9+
}
10+
}
11+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/bash
2+
# shellcheck disable=1117
3+
4+
# Check and Download Latest Z release
5+
6+
declare PT_dlpath
7+
dllocation=$PT_dlpath
8+
family=$(facter -p os.family)
9+
pe=$(facter -p pe_server_version)
10+
majorversion=${pe%.*}
11+
latest=$(curl https://forge.puppet.com/private/versions/pe | sed -E -e 's/(release")/\n\1/g' | grep "${majorversion}.x" |grep -o -P '.{0,0}latest.{0,13}' | awk '{split($0,a,":"); print a[2]}' | grep -o '".*"' | sed 's/"//g')
12+
13+
if [ -e "/etc/sysconfig/pe-puppetserver" ] || [ -e "/etc/default/pe-puppetserver" ];then
14+
echo "Puppet master node detected" #Log Line to StdOut for the Console
15+
else
16+
echo "Not a Puppet master node, exiting"
17+
exit 0
18+
fi
19+
20+
21+
if [ "$pe" = "$latest" ]; then
22+
echo "Currently installed Version of Puppet Enterprise $pe , is the Latest Release in the $majorversion stream"
23+
exit 0
24+
fi
25+
26+
27+
28+
case $family in
29+
Debian)
30+
curlfam="ubuntu"
31+
;;
32+
RedHat)
33+
curlfam="el"
34+
;;
35+
Suse)
36+
curlfam="sles"
37+
;;
38+
*)
39+
echo "Not a Supported Master OS."
40+
exit 0
41+
;;
42+
esac
43+
44+
45+
46+
47+
48+
tarball_name="puppet-enterprise-$latest-$curlfam-$(facter -p os.release.major)-$(facter -p os.architecture).tar.gz"
49+
50+
echo "Downloading PE $latest $curlfam $(facter -p os.release.major) $(facter -p os.architecture) to: $dllocation/${tarball_name}"
51+
echo
52+
53+
curl \
54+
-L \
55+
-o "$dllocation/${tarball_name}" \
56+
"https://pm.puppetlabs.com/puppet-enterprise/$latest/puppet-enterprise-$latest-$curlfam-$(facter -p os.release.major)-$(facter -p os.architecture).tar.gz"
57+

0 commit comments

Comments
 (0)