Skip to content

Instantly share code, notes, and snippets.

@samdoran
Last active April 24, 2019 19:49
Show Gist options
  • Save samdoran/dc015a9757641bffa81d37cf07118b67 to your computer and use it in GitHub Desktop.
Save samdoran/dc015a9757641bffa81d37cf07118b67 to your computer and use it in GitHub Desktop.
Soft reboot, then hard reboot
- hosts: lab-centos7
become: yes
gather_facts: yes
module_defaults:
group/cpm:
cpm_url: oob.r1.acme.com
cpm_username: "{{ vault_cpm_username }}"
cpm_password: "{{ vault_cpm_password }}"
use_https: yes
tasks:
- block:
- name: Soft reboot a system
reboot:
rescue:
- name: Hard reboot a server
cpm_plugcontrol:
cpm_action: setplugcontrol
plug_id: A7
plug_state: boot
delegate_to: localhost
become: no
- name: Wait for server to come back up
wait_for_connection:
delay: 60
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment