-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmflan-rhv-deploy-bulk.yml
47 lines (42 loc) · 1.14 KB
/
mflan-rhv-deploy-bulk.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
42
43
44
45
46
47
# file: mflan-rhv-deploy-bulk.yml
#
# prerequisites:
# $ sudo dnf install python-devel libxml2-devel
# $ sudo pip install --upgrade ovirt-engine-sdk-python
#
# extra-vars:
# $ ansible-playbook mflan-rhv-deploy-bulk.yml --ask-vault-pass -e templateName=rhel7.3 -e vmInstanceType=Medium
---
- hosts: localhost
gather_facts: no
vars_files:
- mflan-rhv-vault.yml
vars:
rhvCluster: Home-Cluster
templateName: rhel7.3
vmState: present
vmInstanceType: Small
tasks:
- name: Login to RHV
ovirt_auth:
url: "{{ rhvurl }}"
insecure: yes
username: "{{ rhvuser }}"
password: "{{ rhvpass }}"
- name: Create new "{{ vmName }}" VM from "{{ templateName }}" template
ovirt_vms:
auth: "{{ ovirt_auth }}"
cluster: "{{ rhvCluster }}"
template: "{{ templateName }}"
state: "{{ vmState }}"
name: "{{ item }}"
instance_type: "{{ vmInstanceType }}"
with_items:
- jcall-01
- jcall-02
- jcall-03
- jcall-04
- name: Cleanup RHV auth token
ovirt_auth:
ovirt_auth: "{{ ovirt_auth }}"
state: absent