Last active
March 10, 2017 16:44
-
-
Save ripienaar/3a92d88da2b9a629b912d9b03c514e19 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: update_puppetserver | |
version: "1.0.0" | |
author: R.I.Pienaar <[email protected]> | |
description: Safely upgrades Puppet Server | |
run_as: choria=rip.mcollective | |
loglevel: info | |
tags: | |
- puppet | |
uses: | |
puppet: "~ 1.12.0" | |
nodes: | |
all_nodes: | |
type: mcollective | |
discovery_method: choria | |
test: true | |
puppet_masters: | |
type: mcollective | |
discovery_method: choria | |
test: true | |
classes: | |
- roles::puppetserver | |
tasks: | |
- mcollective: | |
description: "Disable Puppet" | |
nodes: "{{ nodes.all_nodes }}" | |
action: "puppet.disable" | |
silent: true | |
properties: | |
:message: "Disabled while upgrading puppetserver" | |
post: | |
- summarize | |
- mcollective_assert: | |
description: "Wait for Puppet to go idle" | |
action: "puppet.status" | |
nodes: "{{ nodes.all_nodes }}" | |
expression: | |
- :idling | |
- "==" | |
- true | |
pre_sleep: 0 | |
tries: 10 | |
try_sleep: 30 | |
- mcollective: | |
description: "Upate Puppetserver" | |
nodes: "{{ nodes.puppet_masters }}" | |
action: "package.update" | |
properties: | |
:package: "puppetserver" | |
- mcollective: | |
description: "Stop Puppetserver" | |
nodes: "{{ nodes.puppet_masters }}" | |
action: "service.stop" | |
properties: | |
:service: "puppetserver" | |
- mcollective: | |
description: "Start Puppetserver" | |
nodes: "{{ nodes.puppet_masters }}" | |
action: "service.start" | |
properties: | |
:service: "puppetserver" | |
- mcollective: | |
description: "Enable Puppet" | |
nodes: "{{ nodes.all_nodes }}" | |
action: "puppet.enable" | |
silent: true | |
post: | |
- summarize | |
- mcollective: | |
description: "Run Puppet" | |
nodes: "{{ nodes.all_nodes }}" | |
action: "puppet.runonce" | |
batch_size: 1 | |
post: | |
- summarize | |
hooks: | |
on_success: | |
- slack: | |
description: "Successful Deploy" | |
token: "xoxp-xx" | |
channel: "#general" | |
text: "Updated Puppet Server on {{ nodes.puppet_masters }}" | |
color: "ok" | |
on_fail: | |
- slack: | |
description: "Failed Deploy" | |
token: "xoxp-xx" | |
channel: "#general" | |
text: "Failed to update Puppet Server on {{ nodes.puppet_masters }} in task `{{{ previous_task.description }}}`: ```{{{ previous_task.msg }}}```" | |
color: "danger" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment