My one remaining challenge is successfully renaming the VM disk alias, which fails with the error below.
Would really appreciate help with this.
---
- hosts: ovirt.ovirt.mydom.internal
tasks:
- import_tasks: ovirt_auth.yml
- name: Creates new virtual machine
ovirt.ovirt.ovirt_vm:
auth: "{{ ovirt_auth }}"
name: "{{ vm_fqdn }}"
state: running
clone: true
cluster: lrg0-ovirt-cluster
storage_domain: lrg0-ovirt-mydom-internal-Local
template: template-test00-centos8
type: server
disk_format: raw
nics:
- name: eth0
boot_protocol: dhcp
interface: virtio
profile_name: "{{ net_profile_name }}"
graphical_console:
protocol:
- spice
- vnc
cloud_init:
regenerate_ssh_keys: true
host_name: "{{ vm_fqdn }}"
user_name: mydomadmin
root_password: <password>
dns_search: services.mydom.internal mydom.internal
dns_servers: 10.200.20.4 10.200.20.6
custom_script: |
write_files:
- path: /tmp/setup.sh
permissions: '0755'
content: |
#!/bin/bash
echo "$(hostnamectl )" > /tmp/echos.txt
ipa-client-install --hostname=$(hostname -f) \
--server=ipa0.services.mydom.internal \
--mkhomedir --domain=service.mydom.internal \
--realm=SERVICES.mydom.INTERNAL --no-ntp \
--principal=admin --password=<password> \
--enable-dns-updates --unattended
# auto-mount stuff
cat << EOF >> /etc/auto.misc
* -rw,fstype=nfs nfs1.services.mydom.internal:/share/&
EOF
sed -i 's/\/misc/\/share/' /etc/auto.master
setsebool -P use_nfs_home_dirs on
systemctl enable --now autofs
systemctl start autofs
runcmd:
- [ /tmp/setup.sh, "{{ vm_fqdn }}" ]
- name: Print vm attributes
ovirt.ovirt.ovirt_vm_info:
auth: "{{ ovirt_auth }}"
pattern: name="{{ vm_fqdn }}"
register: vm_info
- debug:
msg: "{{ vm_info.ovirt_vms[0] }}"
- name: Rename disk
ovirt.ovirt.ovirt_disk:
auth: "{{ ovirt_auth }}"
id: "{{ vm_info.ovirt_vms[0].id }}"
storage_domain: lrg0-ovirt-mydom-internal-Local
name: "{{ vm_fqdn }}-osdisk0"
vm_name: "{{ vm_fqdn }}"
TASK [Rename disk] *********************************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ovirtsdk4.Error: Fault reason is "Incomplete parameters". Fault detail is "Disk [provisionedSize] required for add". HTTP response code is 400.
fatal: [ovirt.ovirt.trove.internal]: FAILED! => {"changed": false, "msg": "Fault reason is \"Incomplete parameters\". Fault detail is \"Disk [provisionedSize] required for add\". HTTP response code is 400."}
PLAY RECAP *****************************************************************************************************************************************************************************