-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathrhv-template-deploy.yml
More file actions
40 lines (35 loc) · 1 KB
/
rhv-template-deploy.yml
File metadata and controls
40 lines (35 loc) · 1 KB
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
# file: rhv-template-deploy-new.yml
#
# prerequisites:
# $ sudo yum --enablerepo=rhel-7-server-rhv-4.1-rpms install python-ovirt-engine-sdk4
#
# extra-vars:
# $ ansible-playbook rhv-template-deploy-new.yml --ask-vault-pass -e vmName=CHANGEME -e templateName=CHANGEME
---
- hosts: localhost
gather_facts: no
vars_files:
- rhv-vault.yml
vars:
vmState: running
vmName: CHANGEME
templateName: rhel-7-rhv-tmp2
rhvCluster: Basement
tasks:
- name: Login to RHV
ovirt_auth:
url: https://rhvm.home.lab/ovirt-engine/api
insecure: yes
username: "{{ rhvuser }}"
password: "{{ rhvpass }}"
- name: Create a new VM "{{ vmName }}" from "{{ templateName }}" template
ovirt_vms:
auth: "{{ ovirt_auth }}"
cluster: "{{ rhvCluster }}"
name: "{{ vmName }}"
state: "{{ vmState }}"
template: "{{ templateName }}"
- name: Cleanup RHV auth token
ovirt_auth:
ovirt_auth: "{{ ovirt_auth }}"
state: absent