vhost_update: allow prompt to set targets for update / reboot
Signed-off-by: Kevin Fenzi <kevin@scrye.com>
This commit is contained in:
parent
81b2f70ba6
commit
7fd4ed4c67
2 changed files with 19 additions and 5 deletions
|
@ -16,6 +16,10 @@
|
|||
# TODO: Figure out how to compare virt info pre and post boot.
|
||||
|
||||
- name: find instances
|
||||
vars_prompt:
|
||||
- name: target
|
||||
prompt: What is the target vhost
|
||||
private: false
|
||||
hosts: "{{ target }}"
|
||||
gather_facts: False
|
||||
user: root
|
||||
|
@ -33,6 +37,9 @@
|
|||
local_action: add_host hostname={{ item }} groupname=myvms_new
|
||||
with_items: "{{ vmlist.list_vms }}"
|
||||
|
||||
- name: add the vmhost to target group
|
||||
local_action: add_host hostname={{ target }} groupname=target
|
||||
|
||||
# Call out to another playbook. Disable any proxies that may live here
|
||||
- name: update proxy dns if needed
|
||||
import_playbook: update-proxy-dns.yml
|
||||
|
@ -72,7 +79,7 @@
|
|||
- name: shutdown vms
|
||||
virt: command=shutdown name={{ inventory_hostname }}
|
||||
ignore_errors: true
|
||||
delegate_to: "{{ target }}"
|
||||
delegate_to: "target"
|
||||
|
||||
- name: wait for the whole set to die.
|
||||
hosts: myvms_new
|
||||
|
@ -84,7 +91,7 @@
|
|||
local_action: wait_for port=22 delay=30 timeout=300 state=stopped host={{ inventory_hostname }}
|
||||
|
||||
- name: reboot vhost
|
||||
hosts: "{{ target }}"
|
||||
hosts: "target"
|
||||
gather_facts: False
|
||||
user: root
|
||||
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
#
|
||||
|
||||
- name: find instances
|
||||
vars_prompt:
|
||||
- name: target
|
||||
prompt: What is the target vhost
|
||||
private: false
|
||||
hosts: "{{ target }}"
|
||||
gather_facts: False
|
||||
user: root
|
||||
|
@ -18,11 +22,14 @@
|
|||
local_action: add_host hostname={{ item }} groupname=myvms_new
|
||||
with_items: '{{vmlist.list_vms}}'
|
||||
|
||||
- name: add the vmhost to target group
|
||||
local_action: add_host hostname={{ target }} groupname=target
|
||||
|
||||
# Call out to another playbook. Disable any proxies that may live here
|
||||
#- include_playbook: update-proxy-dns.yml status=disable proxies=myvms_new:&proxies
|
||||
|
||||
- name: set downtime
|
||||
hosts: "{{ target }}:myvms_new"
|
||||
hosts: "target:myvms_new"
|
||||
gather_facts: False
|
||||
user: root
|
||||
serial: 1
|
||||
|
@ -37,7 +44,7 @@
|
|||
when: nonagios is not defined or not "true" in nonagios
|
||||
|
||||
- name: update the system
|
||||
hosts: "{{ target }}:myvms_new"
|
||||
hosts: "target:myvms_new"
|
||||
gather_facts: True
|
||||
user: root
|
||||
|
||||
|
@ -70,7 +77,7 @@
|
|||
when: package_excludes is defined
|
||||
|
||||
- name: run rkhunter if installed
|
||||
hosts: "{{ target }}:myvms_new"
|
||||
hosts: "target:myvms_new"
|
||||
user: root
|
||||
|
||||
tasks:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue