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