Hello Minseok,

You can use some base image and templates with coud-init and set both there.



Or you can use ansible or so.

- name: Create VM "{{ hostname }}" from template
 ovirt_vm:
   auth: "{{ ovirt_auth }}"
   name: "{{ hostname }}"
   comment: "{{ ovirt_comment }}"
   description: "{{ ovirt_description }}"
   template: "{{ ovirt_template }}"
   cluster: "{{ ovirt_cluster }}"
   memory: "{{ ovirt_vm_memory }}"
   memory_max: "{{ ovirt_vm_memory_max }}"
   memory_guaranteed: "{{ ovirt_vm_memory }}"
   cpu_cores: "{{ ovirt_vm_cores }}"
   cpu_sockets: "{{ ovirt_vm_sockets }}"
   operating_system: "{{ ovirt_operating_system }}"
   clone: true
   nics:
     - name: "{{ ovirt_nic_name }}"
       profile_name: "{{ ovirt_nic_profile }}"
   cloud_init_persist: True
   cloud_init:
     host_name: "{{ hostname }}"
     timezone: "GMT+01:00"
     dns_servers: "{{ ovirt_dns_servers }}"
     authorized_ssh_keys: "{{ ovirt_default_ssh_keys }}"
   cloud_init_nics:
     - nic_name: "{{ ovirt_nic_name }}"
       nic_boot_protocol: static
       nic_ip_address: "{{ ovirt_nic_ip_address }}"
       nic_netmask: "{{ ovirt_nic_netmask }}"
       nic_gateway: "{{ ovirt_nic_gateway }}"
       nic_on_boot: True
   wait: yes


Jirka

On 7/4/22 06:52, msjang@kisti.re.kr wrote:
Hi, all.

I've used cockpit-machine, qemu-kvm for 2 years for my services, and I tried to use ovirt for a month. I've use virt-edit to configure ifcfg-eth0 for static IP as my company does not allow DHCP. I've use virt-customize to set default root password.

How can I set static IP and root password when creating VM? Currently, I use virt-edit, virt-customize after I set saslpasswd2 on image files of oVirt, and it seems not best practice.

Best Regards.

Minseok Jang
_______________________________________________
Users mailing list -- users@ovirt.org
To unsubscribe send an email to users-leave@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/5B4KZKEOD6JHE5L6T7E4775F4SST3QBI/