Hi, there,
You would need an ansible XOA provider to be able to create virtual machines with a template like vmware does:
- name: clone VM
vmware_guest:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: "{{ vcenter_validate_certs }}"
datacenter: "{{ vcenter_datacenter }}"
cluster: "{{ vcenter_cluster }}"
name: SRV-NAMEVM
folder: FOLDERTEST
template: "{{ vm_template }}"
networks:
- name: LAN NETWORK
ip: "{{ new_ip }}"
netmask: "{{ netmask }}"
gateway: "{{ gateway }}"
domain: "{{ domain }}"
wait_for_ip_address: True
customization:
hostname: "{{ hostname }}"
domain: "{{ domain }}"
dns_servers:
- "{{ dns1 }}"
- "{{ dns2 }}"
dns_suffix:
- "{{ domain }}"
state: poweredon
Same for recovering and deleting the VM from ansible :
- name: INFO VM
vmware_guest_info:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: "{{ vcenter_validate_certs }}"
datacenter: "{{ vcenter_datacenter }}"
name: SRV-NAMEVM
delegate_to: localhost
register: vm_info
- name: Shutdown VM...
vmware_guest:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: "{{ vcenter_validate_certs }}"
datacenter: "{{ vcenter_datacenter }}"
name: SRV-NAMEVM
state: poweredoff
- name: delete VM...
vmware_guest:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: "{{ vcenter_validate_certs }}"
datacenter: "{{ vcenter_datacenter }}"
name: SRV-NAMEVM
state: absent