So far I believe I am very close to getting Ansible to launch a VM template in oVirt. I'm able to authenticate without an issue, I believe specify the quota but even though it's launching a template it cannot find its data_center. No examples that I can find define data_center in the ovirt_vm module, this is what I have:
---
# tasks file for ovirt-template-launch
- name: Login to oVirt
ovirt_auth:
hostname: "{{ ovirt_hostname }}"
url: "{{ ovirt_ind_url }}"
username: "{{ ovirt_login_username }}"
password: "{{ ovirt_login_password }}"
insecure: true
- name: Create persistent SSO token
ovirt_vm:
auth: "{{ ovirt_auth }}"
state: absent
name: myvm
# Gather quota/datacenter
- ovirt_quota_info:
data_center: "{{ ovirt_datacenter }}"
name: "{{ ovirt_quota }}"
auth: "{{ ovirt_auth }}"
register: result
- name: Run VM with cloud init
ovirt_vm:
name: "{{ vmname }}"
template: centos7-template1
cluster: Default
memory: 2GiB
high_availability: true
high_availability_priority: 50
disks:
- size: 10GiB
name: data
storage_domain: mydomain
interface: virtio
auth: "{{ ovirt_auth }}"
quota_id: "{{ ovirt_quota_id }}"
cloud_init:
nic_boot_protocol: static
nic_ip_address: 10.0.1.5
nic_netmask: 255.255.254.0
nic_gateway: 10.0.1.1
nic_name: eth0
nic_on_boot: true
host_name: testdomain.com
custom_script: |
write_files:
- content: |
Hello, world!
path: /tmp/greeting.txt
permissions: '0644'
Error is:
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'NoneType' object has no attribute 'data_center' fatal: [localhost]: FAILED! => {"changed": false, "msg": "'NoneType' object has no attribute 'data_center'"}