-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcreate_vm.yaml
49 lines (44 loc) · 1.42 KB
/
create_vm.yaml
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
48
49
---
- name: Setup oVirt environment
hosts: rhevm
tasks:
- block:
- name: Include oVirt password
no_log: true
include_vars: vars.yaml
- name: Obtain SSO token
ovirt_auth:
url: "{{ engine_url }}"
username: "{{ username }}"
password: "{{ password }}"
ca_file: "{{ engine_cafile }}"
- name: Create VM from {{ template }}
ovirt_vms:
auth: "{{ ovirt_auth }}"
name: "{{ vm_name }}"
template: "{{ template }}"
cluster: "{{ cluster }}"
memory: 1GiB
high_availability: true
#state: present
cloud_init:
nic_boot_protocol: static
nic_ip_address: "{{ ip }}"
nic_netmask: "{{ netmask }}"
nic_gateway: "{{ gateway }}"
nic_name: "{{ nic1 }}"
nic_on_boot: true
host_name: "{{ hostname }}"
custom_script: |
write_files:
- content: |
Hello, world!
path: /tmp/greeting.txt
permissions: '0644'
user_name: root
root_password: 'admin123'
always:
- name: Revoke the SSO token
ovirt_auth:
state: absent
ovirt_auth: "{{ ovirt_auth }}"