forked from johnsimcall/storage-install
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgluster-shutdown-vms.yml
41 lines (36 loc) · 1023 Bytes
/
gluster-shutdown-vms.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# file: gluster-shutdown-vms.yml
#
# prerequisites:
# $ sudo yum --enablerepo=rhel-7-server-rhv-4.1-rpms install python-ovirt-engine-sdk4
#
# execution:
# $ ansible-playbook gluster-shutdown-vms.yml --ask-vault-pass -e vmState=absent
---
- hosts: localhost
gather_facts: yes
vars_files:
- "{{ ansible_domain }}/rhvm-vault.yml"
- "{{ ansible_domain }}/gluster-vars.yml"
vars_prompt:
- name: "vmState"
prompt: "stopped or absent?"
default: "stopped"
private: no
tasks:
- name: Login to RHV
ovirt_auth:
url: "{{ rhvurl }}"
insecure: yes
username: "{{ rhvuser }}"
password: "{{ rhvpass }}"
- name: Set VMs to state "{{ vmState }}"
ovirt_vms:
auth: "{{ ovirt_auth }}"
name: "{{ item.key }}"
state: "{{ vmState }}"
wait: false
with_dict: "{{ vms }}" # See gluster-home.lab-vars.yml
- name: Cleanup RHV auth token
ovirt_auth:
ovirt_auth: "{{ ovirt_auth }}"
state: absent