[ovirt-users] Re: Creating VMs from templates with their own disks
I would put that code in vm_create.yml and then you can: - name: Create VMs include_tasks: vm_create.yml loop: - VM1 - VM2 loop_control: loop_var: vm_name Then inside your vm_create.yml you will use "{{ vm_name }}" as the name of the VM. Best Regards,Strahil Nikolov On Sun, Nov 28, 2021 at 16:42, Sina Owolabi wrote: Amazing. Thanks! Works! No to figure out how to create multiple vms at a time! On Sun, Nov 28, 2021 at 2:32 PM Gianluca Cecchi wrote: > > On Sun, Nov 28, 2021 at 3:44 AM Sina Owolabi wrote: >> >> >> - 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] }}" >> > > here above you get an empty disk_attachments field. > You have to add fetch_nested: true to traverse and get the disk attachments > values > > Eg: > - name: Print vm attributes > ovirt.ovirt.ovirt_vm_info: > auth: "{{ ovirt_auth }}" > pattern: name="{{ vm_fqdn }}" > fetch_nested: true > 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 }}" >> > > Here, supposing from pattern filter above you get only 1 VM so you can use > index 0 and you get only 1 disk inside the VM and you can use index 0 also > for disk, you can use: > See also "ansible-doc ovirt_vm_info" help page, where you can filter the > nested_attributes... > Then the rename disk task would become > > - name: Rename disk > ovirt.ovirt.ovirt_disk: > auth: "{{ ovirt_auth }}" > id: "{{ vm_info.ovirt_vms[0].disk_attachments[0].id }}" > storage_domain: lrg0-ovirt-mydom-internal-Local > name: "{{ vm_fqdn }}-osdisk0" > vm_name: "{{ vm_fqdn }}" > > This works for me in a 4.4.7 test environment > > HIH, > Gianluca > > > -- cordially yours, Sina Owolabi +2348176469061 ___ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-le...@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/XNBRIBAOLD4GK5LKVUJNJPACCNPZ7K66/ ___ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-le...@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/CQOITGRVPOOYYOD72W6LLLF6UHVOAT3M/
[ovirt-users] Re: Creating VMs from templates with their own disks
Amazing. Thanks! Works! No to figure out how to create multiple vms at a time! On Sun, Nov 28, 2021 at 2:32 PM Gianluca Cecchi wrote: > > On Sun, Nov 28, 2021 at 3:44 AM Sina Owolabi wrote: >> >> >> - 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] }}" >> > > here above you get an empty disk_attachments field. > You have to add fetch_nested: true to traverse and get the disk attachments > values > > Eg: > - name: Print vm attributes > ovirt.ovirt.ovirt_vm_info: > auth: "{{ ovirt_auth }}" > pattern: name="{{ vm_fqdn }}" > fetch_nested: true > 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 }}" >> > > Here, supposing from pattern filter above you get only 1 VM so you can use > index 0 and you get only 1 disk inside the VM and you can use index 0 also > for disk, you can use: > See also "ansible-doc ovirt_vm_info" help page, where you can filter the > nested_attributes... > Then the rename disk task would become > > - name: Rename disk > ovirt.ovirt.ovirt_disk: > auth: "{{ ovirt_auth }}" > id: "{{ vm_info.ovirt_vms[0].disk_attachments[0].id }}" > storage_domain: lrg0-ovirt-mydom-internal-Local > name: "{{ vm_fqdn }}-osdisk0" > vm_name: "{{ vm_fqdn }}" > > This works for me in a 4.4.7 test environment > > HIH, > Gianluca > > > -- cordially yours, Sina Owolabi +2348176469061 ___ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-le...@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/XNBRIBAOLD4GK5LKVUJNJPACCNPZ7K66/
[ovirt-users] Re: Creating VMs from templates with their own disks
On Sun, Nov 28, 2021 at 3:44 AM Sina Owolabi wrote: > > - 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] }}" > > here above you get an empty disk_attachments field. You have to add fetch_nested: true to traverse and get the disk attachments values Eg: - name: Print vm attributes ovirt.ovirt.ovirt_vm_info: auth: "{{ ovirt_auth }}" pattern: name="{{ vm_fqdn }}" fetch_nested: true 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 }}" > > Here, supposing from pattern filter above you get only 1 VM so you can use index 0 and you get only 1 disk inside the VM and you can use index 0 also for disk, you can use: See also "ansible-doc ovirt_vm_info" help page, where you can filter the nested_attributes... Then the rename disk task would become - name: Rename disk ovirt.ovirt.ovirt_disk: auth: "{{ ovirt_auth }}" id: "{{ vm_info.ovirt_vms[0].disk_attachments[0].id }}" storage_domain: lrg0-ovirt-mydom-internal-Local name: "{{ vm_fqdn }}-osdisk0" vm_name: "{{ vm_fqdn }}" This works for me in a 4.4.7 test environment HIH, Gianluca ___ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-le...@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/KAS7RHBOSQ2YQ37DU3KHWNPH6XCSELML/
[ovirt-users] Re: Creating VMs from templates with their own disks
I seem to have been able to overcome yaml problems, and I am able to successfully create Centos8 VMs with cloud-init. My one remaining challenge is successfully renaming the VM disk alias, which fails with the error below. Would really appreciate help with this. My current playbook looks like what’s below, --- - 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: 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= \ --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 }}" Error: 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. [WARNING]: Module did not set no_log for pass_discard 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 * > On 27 Nov 2021, at 23:38, Strahil Nikolov wrote: > > Does it work when you remove the 'custom_script' section ? > > Best Regards, > Strahil Nikolov > > On Sat, Nov 27, 2021 at 7:35, Sina Owolabi > wrote: > No errors at all > Same results again > Screenshot attached for a better view, but this is where it's at right now: > > sso: true > disk_format: raw > graphical_console: > protocol: > - spice > - vnc > cloud_init: > regenerate_ssh_keys: true > host_name: "{{ vm_fqdn }}" > dns_search: mydom.internal > dns_servers: > custom_script: | > write_files: > - path: /tmp/setup.sh > permissions: '0755' > content: | > #!/bin/bash > echo "$(hostname -f)" >> /tmp/myhostname.txt > ipa-client-install --hostname=`hostname -f` \ > --mkhomedir --domain=services.mydom.internal \ > --realm=SERVICES.MYDOM.INTERNAL --no-ntp \ > --principal=admin --password= \ > --enable-dns-updates --unattended > user_name: mydomadmin > root_password: > > - name: Print vm attributes > ovirt.ovirt.ovirt_vm_info: > auth: "{{ ovirt_auth }}" > pattern:
[ovirt-users] Re: Creating VMs from templates with their own disks
Does it work when you remove the 'custom_script' section ? Best Regards,Strahil Nikolov On Sat, Nov 27, 2021 at 7:35, Sina Owolabi wrote: No errors at all Same results again Screenshot attached for a better view, but this is where it's at right now: sso: true disk_format: raw graphical_console: protocol: - spice - vnc cloud_init: regenerate_ssh_keys: true host_name: "{{ vm_fqdn }}" dns_search: mydom.internal dns_servers: custom_script: | write_files: - path: /tmp/setup.sh permissions: '0755' content: | #!/bin/bash echo "$(hostname -f)" >> /tmp/myhostname.txt ipa-client-install --hostname=`hostname -f` \ --mkhomedir --domain=services.mydom.internal \ --realm=SERVICES.MYDOM.INTERNAL --no-ntp \ --principal=admin --password= \ --enable-dns-updates --unattended user_name: mydomadmin root_password: - 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] }}" On Sat, Nov 27, 2021 at 12:51 AM Strahil Nikolov wrote: > > yaml is picky... > > > write_files: > - path: /tmp/setup.sh > permissions: '0755' > content: | > > permissions & content should be on the same indentation with path: > > - path > permissions > content > > What is the error you receive ? > > > Best Regards, > Strahil Nikolov > > On Sat, Nov 27, 2021 at 1:19, Sina Owolabi > wrote: > ___ > Users mailing list -- users@ovirt.org > To unsubscribe send an email to users-le...@ovirt.org > Privacy Statement: https://www.ovirt.org/privacy-policy.html > oVirt Code of Conduct: > https://www.ovirt.org/community/about/community-guidelines/ > List Archives: > https://lists.ovirt.org/archives/list/users@ovirt.org/message/HLTC34PWJICMOLLVCZBE44XOZG7TGWU7/ > -- cordially yours, Sina Owolabi +2348176469061 ___ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-le...@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/7MF5TFHPGCYCDYW7OFLOP4HBIELLMJXA/
[ovirt-users] Re: Creating VMs from templates with their own disks
No errors at all Same results again Screenshot attached for a better view, but this is where it's at right now: sso: true disk_format: raw graphical_console: protocol: - spice - vnc cloud_init: regenerate_ssh_keys: true host_name: "{{ vm_fqdn }}" dns_search: mydom.internal dns_servers: custom_script: | write_files: - path: /tmp/setup.sh permissions: '0755' content: | #!/bin/bash echo "$(hostname -f)" >> /tmp/myhostname.txt ipa-client-install --hostname=`hostname -f` \ --mkhomedir --domain=services.mydom.internal \ --realm=SERVICES.MYDOM.INTERNAL --no-ntp \ --principal=admin --password= \ --enable-dns-updates --unattended user_name: mydomadmin root_password: - 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] }}" On Sat, Nov 27, 2021 at 12:51 AM Strahil Nikolov wrote: > > yaml is picky... > > > write_files: > - path: /tmp/setup.sh > permissions: '0755' > content: | > > permissions & content should be on the same indentation with path: > > - path > permissions > content > > What is the error you receive ? > > > Best Regards, > Strahil Nikolov > > On Sat, Nov 27, 2021 at 1:19, Sina Owolabi > wrote: > ___ > Users mailing list -- users@ovirt.org > To unsubscribe send an email to users-le...@ovirt.org > Privacy Statement: https://www.ovirt.org/privacy-policy.html > oVirt Code of Conduct: > https://www.ovirt.org/community/about/community-guidelines/ > List Archives: > https://lists.ovirt.org/archives/list/users@ovirt.org/message/HLTC34PWJICMOLLVCZBE44XOZG7TGWU7/ > -- cordially yours, Sina Owolabi +2348176469061 ___ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-le...@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/JSXPORQCJE43VAU43Y53GBKICXNMWU75/
[ovirt-users] Re: Creating VMs from templates with their own disks
yaml is picky... write_files: - path: /tmp/setup.sh permissions: '0755' content: | permissions & content should be on the same indentation with path: - path permissions content What is the error you receive ? Best Regards,Strahil Nikolov On Sat, Nov 27, 2021 at 1:19, Sina Owolabi wrote: ___ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-le...@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/HLTC34PWJICMOLLVCZBE44XOZG7TGWU7/ ___ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-le...@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/RU4B5524HSHMPK4K2CPUJVM4GFMLO73E/
[ovirt-users] Re: Creating VMs from templates with their own disks
Yep. Your code: cloud_init: custom_script: | host_name: "{{ vm_fqdn }}" user_name: myadmin user_password: write_files: - path: /tmp/setup.sh permissions: '0755' content: | #!/bin/bash echo "$(hostnamectl)" >> /tmp/myhostname.txt Yet, in "custom_script" there is no "host_name" (indentation shows that host_name is part of the custom script, not to mention the "|" character). Try with: cloud_init: host_name: "{{ vm_fqdn }}" user_name: myadmin # I can't find this one in https://docs.ansible.com/ansible/latest/collections/ovirt/ovirt/ovirt_vm_module.html #user_password: root_password: custom_script: | write_files: - path: /tmp/setup.sh permissions: '0755' content: | #!/bin/bash echo "$(hostnamectl)" >> /tmp/myhostname.txt Best Regards, Strahil Nikolov В петък, 26 ноември 2021 г., 19:33:16 Гринуич+2, Staniforth, Paul написа: #yiv9174097940 P {margin-top:0;margin-bottom:0;}Hi Sina, These should be part of the cloud-init dictionary and are strict about indentation. e.g. from the documentation. - name: Run VM with cloud init ovirt.ovirt.ovirt_vm: name: rhel7 template: rhel7 cluster: Default memory: 1GiB high_availability: true high_availability_priority: 50 # Available from Ansible 2.5 cloud_init: dns_servers: '8.8.8.8 8.8.4.4' nic_boot_protocol: static nic_ip_address: 10.34.60.86 nic_netmask: 255.255.252.0 nic_gateway: 10.34.63.254 nic_name: eth1 host_name: example.com custom_script: | write_files: - content: | Hello, world! path: /tmp/greeting.txt permissions: '0644' user_name: root root_password: super_passwordRegards, Paul S. From: Sina Owolabi Sent: 26 November 2021 16:43 To: Staniforth, Paul Cc: users@ovirt.org Subject: Re: [ovirt-users] Re: Creating VMs from templates with their own disks Caution External Mail: Do not click any links or open any attachments unless you trust the sender and know that the content is safe. Same thing when its written as 'hostname': atal: [ovirt.ovirt.trove.internal]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (ovirt.ovirt.ovirt_vm) module: hostname Supported parameters include: affinity_gr gs, affinity_label_mappings, allow_partial_import, auth, ballooning_enabled, bios_type, boot_devices, boot_menu, cd_iso, clone, clone_permissions, cloud_init, cloud_init_nics, cloud_i t, cluster, cluster_mappings, comment, cpu_cores, cpu_mode, cpu_pinning, cpu_shares, cpu_sockets, cpu_threads, custom_compatibility_version, custom_emulated_machine, custom_properties rotected, description, disk_format, disks, domain_mappings, exclusive, export_domain, export_ova, fetch_nested, force, force_migrate, graphical_console, high_availability, high_availa ority, host, host_devices, id, initrd_path, instance_type, io_threads, kernel_params, kernel_params_persist, kernel_path, kvm, lease, lun_mappings, memory, memory_guaranteed, memory_m e, name, nested_attributes, next_run, nics, numa_nodes, numa_tune_mode, operating_system, placement_policy, placement_policy_hosts, poll_interval, quota_id, reassign_bad_macs, rng_dev mappings, serial_console, serial_policy, serial_policy_value, smartcard_enabled, snapshot_name, snapshot_vm, soundcard_enabled, sso, state, stateless, storage_domain, sysprep, templat e_version, ticket, timeout, timezone, type, usb_support, use_latest_template_version, vmware, vnic_profile_mappings, wait, watchdog, xen"} On Fri, Nov 26, 2021 at 5:35 PM Sina Owolabi wrote: > > And Paul > > when I try to add host_name, I get this error: > > TASK [Creates new virtual machine] > > fatal: [ovirt.ovirt.trove.internal]: FAILED! => {"changed": false, > "msg": "Unsupported parameters for (ovirt.ovirt.ovirt_vm) module: > host_name, regenerate_ssh_keys Supported parameter > affinity_group_mappings, affinity_label_mappings, > allow_partial_import, auth, ballooning_enabled, bios_type, > boot_devices, boot_menu, cd_iso, clone, clone_permissions, cloud_init, > cl > ics, cloud_init_persist, cluster, cluster_mappings, comment, > cpu_cores, cpu_mode, cpu_pinning, cpu_shares, cpu_sockets, > cpu_threads, custom_compatibility_version, custom_emulated_mach > m_properties, delete_protected, description, disk_format, disks, > domain_mappings, exclusive, export_domain, export_ova, fetch_nested, > force, force_migrate, graphical_console, high_ava > high_availability_priority, host, host_devices, id, initrd_path, > instance_type, io_threads, kernel_params, kernel_params_persist, > kernel_path, kvm, lease, lun_mappings, memory, m
[ovirt-users] Re: Creating VMs from templates with their own disks
Hi Sina, These should be part of the cloud-init dictionary and are strict about indentation. e.g. from the documentation. - name: Run VM with cloud init ovirt.ovirt.ovirt_vm: name: rhel7 template: rhel7 cluster: Default memory: 1GiB high_availability: true high_availability_priority: 50 # Available from Ansible 2.5 cloud_init: dns_servers: '8.8.8.8 8.8.4.4' nic_boot_protocol: static nic_ip_address: 10.34.60.86 nic_netmask: 255.255.252.0 nic_gateway: 10.34.63.254 nic_name: eth1 host_name: example.com custom_script: | write_files: - content: | Hello, world! path: /tmp/greeting.txt permissions: '0644' user_name: root root_password: super_password Regards, Paul S. From: Sina Owolabi Sent: 26 November 2021 16:43 To: Staniforth, Paul Cc: users@ovirt.org Subject: Re: [ovirt-users] Re: Creating VMs from templates with their own disks Caution External Mail: Do not click any links or open any attachments unless you trust the sender and know that the content is safe. Same thing when its written as 'hostname': atal: [ovirt.ovirt.trove.internal]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (ovirt.ovirt.ovirt_vm) module: hostname Supported parameters include: affinity_gr gs, affinity_label_mappings, allow_partial_import, auth, ballooning_enabled, bios_type, boot_devices, boot_menu, cd_iso, clone, clone_permissions, cloud_init, cloud_init_nics, cloud_i t, cluster, cluster_mappings, comment, cpu_cores, cpu_mode, cpu_pinning, cpu_shares, cpu_sockets, cpu_threads, custom_compatibility_version, custom_emulated_machine, custom_properties rotected, description, disk_format, disks, domain_mappings, exclusive, export_domain, export_ova, fetch_nested, force, force_migrate, graphical_console, high_availability, high_availa ority, host, host_devices, id, initrd_path, instance_type, io_threads, kernel_params, kernel_params_persist, kernel_path, kvm, lease, lun_mappings, memory, memory_guaranteed, memory_m e, name, nested_attributes, next_run, nics, numa_nodes, numa_tune_mode, operating_system, placement_policy, placement_policy_hosts, poll_interval, quota_id, reassign_bad_macs, rng_dev mappings, serial_console, serial_policy, serial_policy_value, smartcard_enabled, snapshot_name, snapshot_vm, soundcard_enabled, sso, state, stateless, storage_domain, sysprep, templat e_version, ticket, timeout, timezone, type, usb_support, use_latest_template_version, vmware, vnic_profile_mappings, wait, watchdog, xen"} On Fri, Nov 26, 2021 at 5:35 PM Sina Owolabi wrote: > > And Paul > > when I try to add host_name, I get this error: > > TASK [Creates new virtual machine] > > fatal: [ovirt.ovirt.trove.internal]: FAILED! => {"changed": false, > "msg": "Unsupported parameters for (ovirt.ovirt.ovirt_vm) module: > host_name, regenerate_ssh_keys Supported parameter > affinity_group_mappings, affinity_label_mappings, > allow_partial_import, auth, ballooning_enabled, bios_type, > boot_devices, boot_menu, cd_iso, clone, clone_permissions, cloud_init, > cl > ics, cloud_init_persist, cluster, cluster_mappings, comment, > cpu_cores, cpu_mode, cpu_pinning, cpu_shares, cpu_sockets, > cpu_threads, custom_compatibility_version, custom_emulated_mach > m_properties, delete_protected, description, disk_format, disks, > domain_mappings, exclusive, export_domain, export_ova, fetch_nested, > force, force_migrate, graphical_console, high_ava > high_availability_priority, host, host_devices, id, initrd_path, > instance_type, io_threads, kernel_params, kernel_params_persist, > kernel_path, kvm, lease, lun_mappings, memory, memor > ed, memory_max, migrate, name, nested_attributes, next_run, nics, > numa_nodes, numa_tune_mode, operating_system, placement_policy, > placement_policy_hosts, poll_interval, quota_id, reas > acs, rng_device, role_mappings, serial_console, serial_policy, > serial_policy_value, smartcard_enabled, snapshot_name, snapshot_vm, > soundcard_enabled, sso, state, stateless, storage_do > rep, template, template_version, ticket, timeout, timezone, type, > usb_support, use_latest_template_version, vmware, > vnic_profile_mappings, wait, watchdog, xen"} > > On Fri, Nov 26, 2021 at 5:11 PM Staniforth, Paul > wrote: > > > > Hi Sina, > > I get easily confused with cloud-init but shouldn't you be > > setting the hostname, username, etc before the custom script? > > > > Also, you could rename the disk as a separate play in your playbook. > > >
[ovirt-users] Re: Creating VMs from templates with their own disks
Same thing when its written as 'hostname': atal: [ovirt.ovirt.trove.internal]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (ovirt.ovirt.ovirt_vm) module: hostname Supported parameters include: affinity_gr gs, affinity_label_mappings, allow_partial_import, auth, ballooning_enabled, bios_type, boot_devices, boot_menu, cd_iso, clone, clone_permissions, cloud_init, cloud_init_nics, cloud_i t, cluster, cluster_mappings, comment, cpu_cores, cpu_mode, cpu_pinning, cpu_shares, cpu_sockets, cpu_threads, custom_compatibility_version, custom_emulated_machine, custom_properties rotected, description, disk_format, disks, domain_mappings, exclusive, export_domain, export_ova, fetch_nested, force, force_migrate, graphical_console, high_availability, high_availa ority, host, host_devices, id, initrd_path, instance_type, io_threads, kernel_params, kernel_params_persist, kernel_path, kvm, lease, lun_mappings, memory, memory_guaranteed, memory_m e, name, nested_attributes, next_run, nics, numa_nodes, numa_tune_mode, operating_system, placement_policy, placement_policy_hosts, poll_interval, quota_id, reassign_bad_macs, rng_dev mappings, serial_console, serial_policy, serial_policy_value, smartcard_enabled, snapshot_name, snapshot_vm, soundcard_enabled, sso, state, stateless, storage_domain, sysprep, templat e_version, ticket, timeout, timezone, type, usb_support, use_latest_template_version, vmware, vnic_profile_mappings, wait, watchdog, xen"} On Fri, Nov 26, 2021 at 5:35 PM Sina Owolabi wrote: > > And Paul > > when I try to add host_name, I get this error: > > TASK [Creates new virtual machine] > > fatal: [ovirt.ovirt.trove.internal]: FAILED! => {"changed": false, > "msg": "Unsupported parameters for (ovirt.ovirt.ovirt_vm) module: > host_name, regenerate_ssh_keys Supported parameter > affinity_group_mappings, affinity_label_mappings, > allow_partial_import, auth, ballooning_enabled, bios_type, > boot_devices, boot_menu, cd_iso, clone, clone_permissions, cloud_init, > cl > ics, cloud_init_persist, cluster, cluster_mappings, comment, > cpu_cores, cpu_mode, cpu_pinning, cpu_shares, cpu_sockets, > cpu_threads, custom_compatibility_version, custom_emulated_mach > m_properties, delete_protected, description, disk_format, disks, > domain_mappings, exclusive, export_domain, export_ova, fetch_nested, > force, force_migrate, graphical_console, high_ava > high_availability_priority, host, host_devices, id, initrd_path, > instance_type, io_threads, kernel_params, kernel_params_persist, > kernel_path, kvm, lease, lun_mappings, memory, memor > ed, memory_max, migrate, name, nested_attributes, next_run, nics, > numa_nodes, numa_tune_mode, operating_system, placement_policy, > placement_policy_hosts, poll_interval, quota_id, reas > acs, rng_device, role_mappings, serial_console, serial_policy, > serial_policy_value, smartcard_enabled, snapshot_name, snapshot_vm, > soundcard_enabled, sso, state, stateless, storage_do > rep, template, template_version, ticket, timeout, timezone, type, > usb_support, use_latest_template_version, vmware, > vnic_profile_mappings, wait, watchdog, xen"} > > On Fri, Nov 26, 2021 at 5:11 PM Staniforth, Paul > wrote: > > > > Hi Sina, > > I get easily confused with cloud-init but shouldn't you be > > setting the hostname, username, etc before the custom script? > > > > Also, you could rename the disk as a separate play in your playbook. > > > > e.g. > > > > # Change Disk Name > > - ovirt.ovirt.ovirt_disk: > > id: ---- > > storage_domain: data > > name: "new_disk_name" > > vm_name: rhel7 > > > > > > Regards, > >Paul S. > > > > > > From: Sina Owolabi > > Sent: 26 November 2021 15:00 > > To: Staniforth, Paul > > Cc: users@ovirt.org > > Subject: Re: [ovirt-users] Re: Creating VMs from templates with their own > > disks > > > > > > Caution External Mail: Do not click any links or open any attachments > > unless you trust the sender and know that the content is safe. > > > > Thanks Paul. > > > > I seem to be getting this by hand, but trying with ansible, I think my > > skills are a bit lacking. > > I can create with ansible, and it seems to work well, except for the fact > > that the new vm is > > created with the hostname of the vm from which the template was made. > > The disk is also named by the template. > &g
[ovirt-users] Re: Creating VMs from templates with their own disks
And Paul when I try to add host_name, I get this error: TASK [Creates new virtual machine] fatal: [ovirt.ovirt.trove.internal]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (ovirt.ovirt.ovirt_vm) module: host_name, regenerate_ssh_keys Supported parameter affinity_group_mappings, affinity_label_mappings, allow_partial_import, auth, ballooning_enabled, bios_type, boot_devices, boot_menu, cd_iso, clone, clone_permissions, cloud_init, cl ics, cloud_init_persist, cluster, cluster_mappings, comment, cpu_cores, cpu_mode, cpu_pinning, cpu_shares, cpu_sockets, cpu_threads, custom_compatibility_version, custom_emulated_mach m_properties, delete_protected, description, disk_format, disks, domain_mappings, exclusive, export_domain, export_ova, fetch_nested, force, force_migrate, graphical_console, high_ava high_availability_priority, host, host_devices, id, initrd_path, instance_type, io_threads, kernel_params, kernel_params_persist, kernel_path, kvm, lease, lun_mappings, memory, memor ed, memory_max, migrate, name, nested_attributes, next_run, nics, numa_nodes, numa_tune_mode, operating_system, placement_policy, placement_policy_hosts, poll_interval, quota_id, reas acs, rng_device, role_mappings, serial_console, serial_policy, serial_policy_value, smartcard_enabled, snapshot_name, snapshot_vm, soundcard_enabled, sso, state, stateless, storage_do rep, template, template_version, ticket, timeout, timezone, type, usb_support, use_latest_template_version, vmware, vnic_profile_mappings, wait, watchdog, xen"} On Fri, Nov 26, 2021 at 5:11 PM Staniforth, Paul wrote: > > Hi Sina, > I get easily confused with cloud-init but shouldn't you be > setting the hostname, username, etc before the custom script? > > Also, you could rename the disk as a separate play in your playbook. > > e.g. > > # Change Disk Name > - ovirt.ovirt.ovirt_disk: > id: ---- > storage_domain: data > name: "new_disk_name" > vm_name: rhel7 > > > Regards, >Paul S. > > > From: Sina Owolabi > Sent: 26 November 2021 15:00 > To: Staniforth, Paul > Cc: users@ovirt.org > Subject: Re: [ovirt-users] Re: Creating VMs from templates with their own > disks > > > Caution External Mail: Do not click any links or open any attachments unless > you trust the sender and know that the content is safe. > > Thanks Paul. > > I seem to be getting this by hand, but trying with ansible, I think my skills > are a bit lacking. > I can create with ansible, and it seems to work well, except for the fact > that the new vm is > created with the hostname of the vm from which the template was made. > The disk is also named by the template. > My ansiblle yaml is below and I'm pretty sure its wrong (especially where it > needs to use cloud-init to inject the correct hostname, and the other > prepping I would like to add). > Please can you help correct me? > > --- > - 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: present > clone: true > cluster: lrg0-ovirt-cluster > storage_domain: lrg0-ovirt-mydom-internal-Local > memory: 16GiB > cpu_cores: 8 > cpu_sockets: 2 > template: template-test00-centos8 > type: server > operating_system: other_linux > sso: true > disk_format: raw > #disks: > # - name: "{{ vm_fqdn }}-disk0" > #bootable: true > #nics: > # - name: nic1 > #boot_protocol: dhcp > #interface: virtio > #profile_name: "{{ net_profile_name }}" > graphical_console: > protocol: > - spice > - vnc > cloud_init: > custom_script: | > host_name: "{{ vm_fqdn }}" > user_name: myadmin > user_password: > write_files: > - path: /tmp/setup.sh > permissions: '0755' > content: | > #!/bin/bash > echo "$(hostnamectl)" >> /tmp/myhostname.txt > > ipa-client-install --hostname=`hostname -f` \ > --mkhomedir --domain=services.mydom.internal \ > -
[ovirt-users] Re: Creating VMs from templates with their own disks
Thanks guys, not sure why the ansible isnt showing up, Posting again: - 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: present clone: true cluster: lrg0-ovirt-cluster storage_domain: lrg0-ovirt-mydom-internal-Local memory: 16GiB cpu_cores: 8 cpu_sockets: 2 template: template-test00-centos8 type: server operating_system: other_linux sso: true disk_format: raw #disks: # - name: "{{ vm_fqdn }}-disk0" #bootable: true #nics: # - name: nic1 #boot_protocol: dhcp #interface: virtio #profile_name: "{{ net_profile_name }}" graphical_console: protocol: - spice - vnc cloud_init: custom_script: | host_name: "{{ vm_fqdn }}" user_name: myadmin user_password: write_files: - path: /tmp/setup.sh permissions: '0755' content: | #!/bin/bash echo "$(hostnamectl)" >> /tmp/myhostname.txt ipa-client-install --hostname=`hostname -f` \ --mkhomedir --domain=services.mydom.internal \ --realm=SERVICES.MYDOM.INTERNAL --no-ntp \ --principal=admin --password= \ --enable-dns-updates --unattended runcmd: - [ /tmp/setup.sh, "{{ vm_fqdn }}" ] On Fri, Nov 26, 2021 at 5:11 PM Staniforth, Paul < p.stanifo...@leedsbeckett.ac.uk> wrote: > Hi Sina, > I get easily confused with cloud-init but shouldn't you be > setting the hostname, username, etc before the custom script? > > Also, you could rename the disk as a separate play in your playbook. > > e.g. > > # Change Disk Name- ovirt.ovirt.ovirt_disk: > id: ---- > storage_domain: data > name: "new_disk_name" > vm_name: rhel7 > > > Regards, >Paul S. > > ------------------ > *From:* Sina Owolabi > *Sent:* 26 November 2021 15:00 > *To:* Staniforth, Paul > *Cc:* users@ovirt.org > *Subject:* Re: [ovirt-users] Re: Creating VMs from templates with their > own disks > > > *Caution External Mail:* Do not click any links or open any attachments > unless you trust the sender and know that the content is safe. > Thanks Paul. > > I seem to be getting this by hand, but trying with ansible, I think my > skills are a bit lacking. > I can create with ansible, and it seems to work well, except for the fact > that the new vm is > created with the hostname of the vm from which the template was made. > The disk is also named by the template. > My ansiblle yaml is below and I'm pretty sure its wrong (especially where > it needs to use cloud-init to inject the correct hostname, and the other > prepping I would like to add). > Please can you help correct me? > > --- > - 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: present > clone: true > cluster: lrg0-ovirt-cluster > storage_domain: lrg0-ovirt-mydom-internal-Local > memory: 16GiB > cpu_cores: 8 > cpu_sockets: 2 > template: template-test00-centos8 > type: server > operating_system: other_linux > sso: true > disk_format: raw > #disks: > # - name: "{{ vm_fqdn }}-disk0" > #bootable: true > #nics: > # - name: nic1 > #boot_protocol: dhcp > #interface: virtio > #profile_name: "{{ net_profile_name }}" > graphical_console: > protocol: > - spice > - vnc > cloud_init: > custom_script: | > host_name: "{{ vm_fqdn }}" > user_name: myadmin > user_password: > write_files: > - path: /tmp/setup.sh > permissions: '0755' > content: | > #!/bin/bash > echo "$(hostnamectl)" >> /tmp/myhostname.txt > > ipa-client-install --hostname=`hostname -f` \ >
[ovirt-users] Re: Creating VMs from templates with their own disks
Hi Sina, I get easily confused with cloud-init but shouldn't you be setting the hostname, username, etc before the custom script? Also, you could rename the disk as a separate play in your playbook. e.g. # Change Disk Name - ovirt.ovirt.ovirt_disk: id: ---- storage_domain: data name: "new_disk_name" vm_name: rhel7 Regards, Paul S. From: Sina Owolabi Sent: 26 November 2021 15:00 To: Staniforth, Paul Cc: users@ovirt.org Subject: Re: [ovirt-users] Re: Creating VMs from templates with their own disks Caution External Mail: Do not click any links or open any attachments unless you trust the sender and know that the content is safe. Thanks Paul. I seem to be getting this by hand, but trying with ansible, I think my skills are a bit lacking. I can create with ansible, and it seems to work well, except for the fact that the new vm is created with the hostname of the vm from which the template was made. The disk is also named by the template. My ansiblle yaml is below and I'm pretty sure its wrong (especially where it needs to use cloud-init to inject the correct hostname, and the other prepping I would like to add). Please can you help correct me? --- - 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: present clone: true cluster: lrg0-ovirt-cluster storage_domain: lrg0-ovirt-mydom-internal-Local memory: 16GiB cpu_cores: 8 cpu_sockets: 2 template: template-test00-centos8 type: server operating_system: other_linux sso: true disk_format: raw #disks: # - name: "{{ vm_fqdn }}-disk0" #bootable: true #nics: # - name: nic1 #boot_protocol: dhcp #interface: virtio #profile_name: "{{ net_profile_name }}" graphical_console: protocol: - spice - vnc cloud_init: custom_script: | host_name: "{{ vm_fqdn }}" user_name: myadmin user_password: write_files: - path: /tmp/setup.sh permissions: '0755' content: | #!/bin/bash echo "$(hostnamectl)" >> /tmp/myhostname.txt ipa-client-install --hostname=`hostname -f` \ --mkhomedir --domain=services.mydom.internal \ --realm=SERVICES.MYDOM.INTERNAL --no-ntp \ --principal=admin --password= \ --enable-dns-updates --unattended runcmd: - [ /tmp/setup.sh, "{{ vm_fqdn }}" ] On Wed, Nov 24, 2021 at 9:26 PM Staniforth, Paul mailto:p.stanifo...@leedsbeckett.ac.uk>> wrote: Hello Sina, to use the template. Create new VM and select the template. Click the advanced options. In the boot section you can set the HD to be the first boot devices and unselect any CD. In the Resource Allocation section, you can set the storage allocation to clone instead of thin ( this will create a copy of the template disk), you can also set the disk alias name. you can also edit the template to make sure the HD is the first boot device. I don't know what's in your ansible yaml definition. Cloning is for copying VMs or snapshots not templates. Regards, Paul S. From: Sina Owolabi mailto:notify.s...@gmail.com>> Sent: 24 November 2021 09:28 To: Staniforth, Paul mailto:p.stanifo...@leedsbeckett.ac.uk>> Cc: users@ovirt.org<mailto:users@ovirt.org> mailto:users@ovirt.org>> Subject: Re: [ovirt-users] Re: Creating VMs from templates with their own disks Caution External Mail: Do not click any links or open any attachments unless you trust the sender and know that the content is safe. Hello Sorry for the late reply, work has been crazy. This doesnt seem to work as advertised, or I am still not getting it. Either way I would really appreciate some help and guidance. Steps I have attempted: 1. Create and configure VM as I want it to be (disk, partitioning, etc). 2. Shutdown the vm, create a template from it. Cloning manually: Cloning fails with this message: Error while executing action: clone00.domain.tld: * Cannot add VM. One or more provided storage domains are either not in active status or of an illegal type for the requested operation. I cant modify the storage allocation, and the disk its attempting to use is the disk of the source VM. Manual template install: Choosing to install manually with a template requires me to add a new disk, and to boot off the CD (defin
[ovirt-users] Re: Creating VMs from templates with their own disks
I don't seeany Ansible code bellow. Best Regards,Strahil Nikolov On Fri, Nov 26, 2021 at 17:04, Sina Owolabi wrote: ___ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-le...@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/EUSFOOXTU6TXQFD6K5IW4JPVMBF5J7WC/ ___ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-le...@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/ZFBMY5NKTZHZSHV5ARF6KDHVSVKTKFHG/
[ovirt-users] Re: Creating VMs from templates with their own disks
Thanks Paul. I seem to be getting this by hand, but trying with ansible, I think my skills are a bit lacking. I can create with ansible, and it seems to work well, except for the fact that the new vm is created with the hostname of the vm from which the template was made. The disk is also named by the template. My ansiblle yaml is below and I'm pretty sure its wrong (especially where it needs to use cloud-init to inject the correct hostname, and the other prepping I would like to add). Please can you help correct me? --- - 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: present clone: true cluster: lrg0-ovirt-cluster storage_domain: lrg0-ovirt-mydom-internal-Local memory: 16GiB cpu_cores: 8 cpu_sockets: 2 template: template-test00-centos8 type: server operating_system: other_linux sso: true disk_format: raw #disks: # - name: "{{ vm_fqdn }}-disk0" #bootable: true #nics: # - name: nic1 #boot_protocol: dhcp #interface: virtio #profile_name: "{{ net_profile_name }}" graphical_console: protocol: - spice - vnc cloud_init: custom_script: | host_name: "{{ vm_fqdn }}" user_name: myadmin user_password: write_files: - path: /tmp/setup.sh permissions: '0755' content: | #!/bin/bash echo "$(hostnamectl)" >> /tmp/myhostname.txt ipa-client-install --hostname=`hostname -f` \ --mkhomedir --domain=services.mydom.internal \ --realm=SERVICES.MYDOM.INTERNAL --no-ntp \ --principal=admin --password= \ --enable-dns-updates --unattended runcmd: - [ /tmp/setup.sh, "{{ vm_fqdn }}" ] On Wed, Nov 24, 2021 at 9:26 PM Staniforth, Paul < p.stanifo...@leedsbeckett.ac.uk> wrote: > Hello Sina, > > to use the template. > > Create new VM and select the template. > > Click the advanced options. > > In the boot section you can set the HD to be the first boot devices and > unselect any CD. > In the Resource Allocation section, you can set the storage allocation to > clone instead of thin ( this will create a copy of the template disk), you > can also set the disk alias name. > > you can also edit the template to make sure the HD is the first boot > device. > > I don't know what's in your ansible yaml definition. > > Cloning is for copying VMs or snapshots not templates. > > Regards, > > Paul S. > -------------- > *From:* Sina Owolabi > *Sent:* 24 November 2021 09:28 > *To:* Staniforth, Paul > *Cc:* users@ovirt.org > *Subject:* Re: [ovirt-users] Re: Creating VMs from templates with their > own disks > > > *Caution External Mail:* Do not click any links or open any attachments > unless you trust the sender and know that the content is safe. > Hello > > Sorry for the late reply, work has been crazy. > > This doesnt seem to work as advertised, or I am still not getting it. > Either way I would really appreciate some help and guidance. > > Steps I have attempted: > 1. Create and configure VM as I want it to be (disk, partitioning, etc). > 2. Shutdown the vm, create a template from it. > > Cloning manually: > Cloning fails with this message: > Error while executing action: > clone00.domain.tld: > >- Cannot add VM. One or more provided storage domains are either not >in active status or of an illegal type for the requested operation. > > I cant modify the storage allocation, and the disk its attempting to use > is the disk of the source VM. > > Manual template install: > Choosing to install manually with a template requires me to add a new > disk, and to boot off the CD (defined in the template) and manually set > things up. This I do not wish to do, because I would rather automate. > > Cloning with ansible, defining the cloud-init script and using the > template: > VM is successfully created, but logging in with remote-viewer drops me > into the installation process (setting up from the attached ISO). Which is > also not desired. > > Please help me with what I am doing wrong. > Again the goal is to have the vm setup with its own credentials. > > > On Thu, Nov 18, 2021 at 9:24 AM Staniforth, Paul < > p.stanifo...@leedsbeckett.ac.uk> wrote: > >
[ovirt-users] Re: Creating VMs from templates with their own disks
Hello Sina, to use the template. Create new VM and select the template. Click the advanced options. In the boot section you can set the HD to be the first boot devices and unselect any CD. In the Resource Allocation section, you can set the storage allocation to clone instead of thin ( this will create a copy of the template disk), you can also set the disk alias name. you can also edit the template to make sure the HD is the first boot device. I don't know what's in your ansible yaml definition. Cloning is for copying VMs or snapshots not templates. Regards, Paul S. From: Sina Owolabi Sent: 24 November 2021 09:28 To: Staniforth, Paul Cc: users@ovirt.org Subject: Re: [ovirt-users] Re: Creating VMs from templates with their own disks Caution External Mail: Do not click any links or open any attachments unless you trust the sender and know that the content is safe. Hello Sorry for the late reply, work has been crazy. This doesnt seem to work as advertised, or I am still not getting it. Either way I would really appreciate some help and guidance. Steps I have attempted: 1. Create and configure VM as I want it to be (disk, partitioning, etc). 2. Shutdown the vm, create a template from it. Cloning manually: Cloning fails with this message: Error while executing action: clone00.domain.tld: * Cannot add VM. One or more provided storage domains are either not in active status or of an illegal type for the requested operation. I cant modify the storage allocation, and the disk its attempting to use is the disk of the source VM. Manual template install: Choosing to install manually with a template requires me to add a new disk, and to boot off the CD (defined in the template) and manually set things up. This I do not wish to do, because I would rather automate. Cloning with ansible, defining the cloud-init script and using the template: VM is successfully created, but logging in with remote-viewer drops me into the installation process (setting up from the attached ISO). Which is also not desired. Please help me with what I am doing wrong. Again the goal is to have the vm setup with its own credentials. On Thu, Nov 18, 2021 at 9:24 AM Staniforth, Paul mailto:p.stanifo...@leedsbeckett.ac.uk>> wrote: Hello, The VMs can get created from a template otherwise the blank template is used if a particular template is used it can be thin dependent VM the VMs disks is linked to the Templates disk and it just carries the changes made in the VMs disk (this is quicker and uses less space if you a lot of disks). The other option is to create a cloned VM and this will copy the Templates disk to the VM so it's no longer dependent. In the ansible documentation look for the clone option. https://docs.ansible.com/ansible/latest/collections/ovirt/ovirt/ovirt_vm_module.html<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.ansible.com%2Fansible%2Flatest%2Fcollections%2Fovirt%2Fovirt%2Fovirt_vm_module.html=04%7C01%7CP.Staniforth%40leedsbeckett.ac.uk%7C0e6edf217c0347eb196108d9af2cbdd6%7Cd79a81124fbe417aa112cd0fb490d85c%7C0%7C0%7C637733430019067207%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000=xlTBIHvb%2Fi%2B2390RAu35HTOfsby7CuFwBgOrCdKmhHA%3D=0> https://www.ovirt.org/documentation/virtual_machine_management_guide/index.html<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.ovirt.org%2Fdocumentation%2Fvirtual_machine_management_guide%2Findex.html=04%7C01%7CP.Staniforth%40leedsbeckett.ac.uk%7C0e6edf217c0347eb196108d9af2cbdd6%7Cd79a81124fbe417aa112cd0fb490d85c%7C0%7C0%7C637733430019067207%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000=iaPa0CGnuB9x25wV83ZbDvdcJyHBHF%2FOyBY2xrJ9zcw%3D=0> Virtual Machine Management Guide<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.ovirt.org%2Fdocumentation%2Fvirtual_machine_management_guide%2Findex.html=04%7C01%7CP.Staniforth%40leedsbeckett.ac.uk%7C0e6edf217c0347eb196108d9af2cbdd6%7Cd79a81124fbe417aa112cd0fb490d85c%7C0%7C0%7C637733430019077198%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000=ac5P2ktyQGaBG4k0%2FKWJEMfe%2F7uV8bLDXHOcoWxe3Fg%3D=0> oVirt is a free open-source virtualization solution for your entire enterprise www.ovirt.org<https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.ovirt.org%2F=04%7C01%7CP.Staniforth%40leedsbeckett.ac.uk%7C0e6edf217c0347eb196108d9af2cbdd6%7Cd79a81124fbe417aa112cd0fb490d85c%7C0%7C0%7C637733430019077198%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000=41%2FlsJsuqQo%2FmUV8cEW2CyfolruFExmO00CA4IHx6Qg%3D=0> For the cloud-init does the cloud-init package need to be installed on the template image? Regards, Paul S. __
[ovirt-users] Re: Creating VMs from templates with their own disks
Hello Sorry for the late reply, work has been crazy. This doesnt seem to work as advertised, or I am still not getting it. Either way I would really appreciate some help and guidance. Steps I have attempted: 1. Create and configure VM as I want it to be (disk, partitioning, etc). 2. Shutdown the vm, create a template from it. Cloning manually: Cloning fails with this message: Error while executing action: clone00.domain.tld: - Cannot add VM. One or more provided storage domains are either not in active status or of an illegal type for the requested operation. I cant modify the storage allocation, and the disk its attempting to use is the disk of the source VM. Manual template install: Choosing to install manually with a template requires me to add a new disk, and to boot off the CD (defined in the template) and manually set things up. This I do not wish to do, because I would rather automate. Cloning with ansible, defining the cloud-init script and using the template: VM is successfully created, but logging in with remote-viewer drops me into the installation process (setting up from the attached ISO). Which is also not desired. Please help me with what I am doing wrong. Again the goal is to have the vm setup with its own credentials. On Thu, Nov 18, 2021 at 9:24 AM Staniforth, Paul < p.stanifo...@leedsbeckett.ac.uk> wrote: > Hello, > The VMs can get created from a template otherwise the blank > template is used if a particular template is used it can be thin dependent > VM the VMs disks is linked to the Templates disk and it just carries the > changes made in the VMs disk (this is quicker and uses less space if you a > lot of disks). The other option is to create a cloned VM and this will copy > the Templates disk to the VM so it's no longer dependent. > > In the ansible documentation look for the clone option. > > https://docs.ansible.com/ansible/latest/collections/ovirt/ovirt/ovirt_vm_module.html > > > https://www.ovirt.org/documentation/virtual_machine_management_guide/index.html > Virtual Machine Management Guide > <https://www.ovirt.org/documentation/virtual_machine_management_guide/index.html> > oVirt is a free open-source virtualization solution for your entire > enterprise > www.ovirt.org > For the cloud-init does the cloud-init package need to be installed on the > template image? > > > Regards, > > Paul S. > -- > *From:* notify.s...@gmail.com > *Sent:* 18 November 2021 07:34 > *To:* users@ovirt.org > *Subject:* [ovirt-users] Re: Creating VMs from templates with their own > disks > > Caution External Mail: Do not click any links or open any attachments > unless you trust the sender and know that the content is safe. > > Im sorry, I am trying to wrap my head around this but it is difficult. > > I just want to be able to stand up new vms, with their own storage, > similar to how I can with plain vanilla KVM, with a template or without, > maybe even with a kickstart, and hopefully with ansible. > > Right now anytime I try to create a VM, using the template, (with > ansible), it gets the template disk attached, and from the console I see > the new vm is named as the vm I created the template with. Cloud init > script that is meant to rename the vm, and join it to IPA, is ignored. > > If I create storage for the vm, before creating it, both the template > storage and the new storage are attached to the vm, which is also > confusing. Cloud init is also ignored. > > I didn't think something this straightforward would end up needing a shift > in thinking about how vms are created, especially with a product that's > more than likely using kvm under the hood. > > I would appreciate some straightforward guiding steps, if I can get them. > Really. It's been a frustrating week. > > > > On 2021-11-17 13:50, Sina Owolabi wrote: > > > > > > You can create a template with no disk, then VM's created from that > > template will also have no disk. Then add a new disk to the VM after you > > create it. This is how the default blank template works. You can also > > create a template with an empty disk, then every VM created will also > > get an empty disk by default. You can always rename disks as well. > ___ > Users mailing list -- users@ovirt.org > To unsubscribe send an email to users-le...@ovirt.org > Privacy Statement: > https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.ovirt.org%2Fprivacy-policy.htmldata=04%7C01%7Cp.staniforth%40leedsbeckett.ac.uk%7Ce92dfae2d8d64a8a5d2308d9aa660b23%7Cd79a81124fbe417aa112cd0fb490d85c%7C0%7C0%7C637728177667805891%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwi
[ovirt-users] Re: Creating VMs from templates with their own disks
Hello, The VMs can get created from a template otherwise the blank template is used if a particular template is used it can be thin dependent VM the VMs disks is linked to the Templates disk and it just carries the changes made in the VMs disk (this is quicker and uses less space if you a lot of disks). The other option is to create a cloned VM and this will copy the Templates disk to the VM so it's no longer dependent. In the ansible documentation look for the clone option. https://docs.ansible.com/ansible/latest/collections/ovirt/ovirt/ovirt_vm_module.html https://www.ovirt.org/documentation/virtual_machine_management_guide/index.html Virtual Machine Management Guide<https://www.ovirt.org/documentation/virtual_machine_management_guide/index.html> oVirt is a free open-source virtualization solution for your entire enterprise www.ovirt.org For the cloud-init does the cloud-init package need to be installed on the template image? Regards, Paul S. From: notify.s...@gmail.com Sent: 18 November 2021 07:34 To: users@ovirt.org Subject: [ovirt-users] Re: Creating VMs from templates with their own disks Caution External Mail: Do not click any links or open any attachments unless you trust the sender and know that the content is safe. Im sorry, I am trying to wrap my head around this but it is difficult. I just want to be able to stand up new vms, with their own storage, similar to how I can with plain vanilla KVM, with a template or without, maybe even with a kickstart, and hopefully with ansible. Right now anytime I try to create a VM, using the template, (with ansible), it gets the template disk attached, and from the console I see the new vm is named as the vm I created the template with. Cloud init script that is meant to rename the vm, and join it to IPA, is ignored. If I create storage for the vm, before creating it, both the template storage and the new storage are attached to the vm, which is also confusing. Cloud init is also ignored. I didn't think something this straightforward would end up needing a shift in thinking about how vms are created, especially with a product that's more than likely using kvm under the hood. I would appreciate some straightforward guiding steps, if I can get them. Really. It's been a frustrating week. > On 2021-11-17 13:50, Sina Owolabi wrote: > > > You can create a template with no disk, then VM's created from that > template will also have no disk. Then add a new disk to the VM after you > create it. This is how the default blank template works. You can also > create a template with an empty disk, then every VM created will also > get an empty disk by default. You can always rename disks as well. ___ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-le...@ovirt.org Privacy Statement: https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.ovirt.org%2Fprivacy-policy.htmldata=04%7C01%7Cp.staniforth%40leedsbeckett.ac.uk%7Ce92dfae2d8d64a8a5d2308d9aa660b23%7Cd79a81124fbe417aa112cd0fb490d85c%7C0%7C0%7C637728177667805891%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000sdata=wIZvVNcinh35Ufj0jodhjIVWj2LtY%2FYgP77rUh0%2BCLs%3Dreserved=0 oVirt Code of Conduct: https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.ovirt.org%2Fcommunity%2Fabout%2Fcommunity-guidelines%2Fdata=04%7C01%7Cp.staniforth%40leedsbeckett.ac.uk%7Ce92dfae2d8d64a8a5d2308d9aa660b23%7Cd79a81124fbe417aa112cd0fb490d85c%7C0%7C0%7C637728177667805891%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000sdata=c%2FCRWL1QjhgQV01hQgph83eW9RtyE83cWPWD%2BN6kmIQ%3Dreserved=0 List Archives: https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.ovirt.org%2Farchives%2Flist%2Fusers%40ovirt.org%2Fmessage%2FURJROHMP6M3LJWAM6A4QMLFXUIYLGPOZ%2Fdata=04%7C01%7Cp.staniforth%40leedsbeckett.ac.uk%7Ce92dfae2d8d64a8a5d2308d9aa660b23%7Cd79a81124fbe417aa112cd0fb490d85c%7C0%7C0%7C637728177667805891%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000sdata=cU62Whas54HNQp8N4r24gCaMXtxaakPrjOjjdbY95mE%3Dreserved=0 To view the terms under which this email is distributed, please go to:- https://leedsbeckett.ac.uk/disclaimer/email ___ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-le...@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/LKPMFRPUKGXC262HXE7JLDHIZDGIQ65R/
[ovirt-users] Re: Creating VMs from templates with their own disks
Im sorry, I am trying to wrap my head around this but it is difficult. I just want to be able to stand up new vms, with their own storage, similar to how I can with plain vanilla KVM, with a template or without, maybe even with a kickstart, and hopefully with ansible. Right now anytime I try to create a VM, using the template, (with ansible), it gets the template disk attached, and from the console I see the new vm is named as the vm I created the template with. Cloud init script that is meant to rename the vm, and join it to IPA, is ignored. If I create storage for the vm, before creating it, both the template storage and the new storage are attached to the vm, which is also confusing. Cloud init is also ignored. I didn't think something this straightforward would end up needing a shift in thinking about how vms are created, especially with a product that's more than likely using kvm under the hood. I would appreciate some straightforward guiding steps, if I can get them. Really. It's been a frustrating week. > On 2021-11-17 13:50, Sina Owolabi wrote: > > > You can create a template with no disk, then VM's created from that > template will also have no disk. Then add a new disk to the VM after you > create it. This is how the default blank template works. You can also > create a template with an empty disk, then every VM created will also > get an empty disk by default. You can always rename disks as well. ___ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-le...@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/URJROHMP6M3LJWAM6A4QMLFXUIYLGPOZ/
[ovirt-users] Re: Creating VMs from templates with their own disks
On 2021-11-17 13:50, Sina Owolabi wrote: Ok thanks Sounds odd but no problem How do I make the new VM use its own disk, named after itself? On Wed, 17 Nov 2021 at 19:45, Alex McWhirter wrote: On 2021-11-17 12:02, notify.s...@gmail.com wrote: Hi All Im very stumped on how to create VMs from templates I've made, but having them installed with their own disks. Please can some one guide me on how to do this? I have Ovirt running, with local storage hypervisors. Anytime I try to use a template, the vm is created and booted with the template's disk. I would especially appreciate how to do this with ansible. Im trying to automate CentOS and Ubuntu VMs. ___ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-le...@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/OX5MWWMYAW4OTYE4NFETM4WFL2YEQFBZ/ When you make a VM from a template there are two possibilities. If the VM type is set to desktop, a qcow overlay is created against the template's disk images. Any changes made in the VM are stored in the overlay.. If the VM type is set to server the template's disks are copied to a new disk, it will have the same name as the template disk, but it is in fact a new disk with the template data copied over. -- Sent from MetroMail You can create a template with no disk, then VM's created from that template will also have no disk. Then add a new disk to the VM after you create it. This is how the default blank template works. You can also create a template with an empty disk, then every VM created will also get an empty disk by default. You can always rename disks as well.___ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-le...@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/TBIPIMGW7C4Q2IKQWZEKJJRCHMKK2FZC/
[ovirt-users] Re: Creating VMs from templates with their own disks
Ok thanks Sounds odd but no problem How do I make the new VM use its own disk, named after itself? On Wed, 17 Nov 2021 at 19:45, Alex McWhirter wrote: > On 2021-11-17 12:02, notify.s...@gmail.com wrote: > > Hi All > > > > Im very stumped on how to create VMs from templates I've made, but > > having them installed with their own disks. > > Please can some one guide me on how to do this? > > I have Ovirt running, with local storage hypervisors. > > > > Anytime I try to use a template, the vm is created and booted with the > > template's disk. > > I would especially appreciate how to do this with ansible. > > Im trying to automate CentOS and Ubuntu VMs. > > ___ > > Users mailing list -- users@ovirt.org > > To unsubscribe send an email to users-le...@ovirt.org > > Privacy Statement: https://www.ovirt.org/privacy-policy.html > > oVirt Code of Conduct: > > https://www.ovirt.org/community/about/community-guidelines/ > > List Archives: > > > https://lists.ovirt.org/archives/list/users@ovirt.org/message/OX5MWWMYAW4OTYE4NFETM4WFL2YEQFBZ/ > > When you make a VM from a template there are two possibilities. > > If the VM type is set to desktop, a qcow overlay is created against the > template's disk images. Any changes made in the VM are stored in the > overlay.. > > If the VM type is set to server the template's disks are copied to a new > disk, it will have the same name as the template disk, but it is in fact > a new disk with the template data copied over. > -- Sent from MetroMail ___ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-le...@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/DDFVVBZCSCKXTW2MWSTNF6MSH5TKDKDI/
[ovirt-users] Re: Creating VMs from templates with their own disks
On 2021-11-17 12:02, notify.s...@gmail.com wrote: Hi All Im very stumped on how to create VMs from templates I've made, but having them installed with their own disks. Please can some one guide me on how to do this? I have Ovirt running, with local storage hypervisors. Anytime I try to use a template, the vm is created and booted with the template's disk. I would especially appreciate how to do this with ansible. Im trying to automate CentOS and Ubuntu VMs. ___ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-le...@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/OX5MWWMYAW4OTYE4NFETM4WFL2YEQFBZ/ When you make a VM from a template there are two possibilities. If the VM type is set to desktop, a qcow overlay is created against the template's disk images. Any changes made in the VM are stored in the overlay.. If the VM type is set to server the template's disks are copied to a new disk, it will have the same name as the template disk, but it is in fact a new disk with the template data copied over. ___ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-le...@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/XKM4XJD7IU6CYDY2GTG3WOLXEZP2QVW4/