fix(virtualization): add XML safety attributes and switch xen to virtio
This commit is contained in:
@@ -23,7 +23,6 @@
|
|||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item | to_json }}"
|
label: "{{ item | to_json }}"
|
||||||
extended: true
|
extended: true
|
||||||
changed_when: false
|
|
||||||
|
|
||||||
- name: Create VM disks
|
- name: Create VM disks
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
@@ -61,6 +60,7 @@
|
|||||||
- "/tmp/cloud-network-config-{{ hostname }}.yml"
|
- "/tmp/cloud-network-config-{{ hostname }}.yml"
|
||||||
creates: "{{ virtualization_libvirt_cloudinit_path }}"
|
creates: "{{ virtualization_libvirt_cloudinit_path }}"
|
||||||
|
|
||||||
|
# uri defaults to qemu:///system (local libvirtd)
|
||||||
- name: Create VM using libvirt
|
- name: Create VM using libvirt
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
community.libvirt.virt:
|
community.libvirt.virt:
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
loop: "{{ system_cfg.disks }}"
|
loop: "{{ system_cfg.disks }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item | to_json }}"
|
label: "{{ item | to_json }}"
|
||||||
changed_when: false
|
|
||||||
|
|
||||||
|
# community.vmware: full-featured guest management
|
||||||
- name: Create VM in vCenter
|
- name: Create VM in vCenter
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
vars:
|
vars:
|
||||||
@@ -34,6 +34,7 @@
|
|||||||
cluster: "{{ hypervisor_cfg.cluster }}"
|
cluster: "{{ hypervisor_cfg.cluster }}"
|
||||||
folder: "{{ system_cfg.path if system_cfg.path | string | length > 0 else omit }}"
|
folder: "{{ system_cfg.path if system_cfg.path | string | length > 0 else omit }}"
|
||||||
name: "{{ hostname }}"
|
name: "{{ hostname }}"
|
||||||
|
# Generic guest ID — VMware auto-detects OS post-install
|
||||||
guest_id: otherLinux64Guest
|
guest_id: otherLinux64Guest
|
||||||
annotation: |
|
annotation: |
|
||||||
{{ note if note is defined else '' }}
|
{{ note if note is defined else '' }}
|
||||||
@@ -90,6 +91,7 @@
|
|||||||
state: present
|
state: present
|
||||||
no_log: true
|
no_log: true
|
||||||
|
|
||||||
|
# vmware.vmware: modern collection for power operations
|
||||||
- name: Start VM in vCenter
|
- name: Start VM in vCenter
|
||||||
when: virtualization_tpm2_enabled | bool
|
when: virtualization_tpm2_enabled | bool
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<domain type='kvm'>
|
<domain type='kvm'>
|
||||||
<name>{{ hostname }}</name>
|
<name>{{ hostname }}</name>
|
||||||
<memory>{{ system_cfg.memory | int * 1024 }}</memory>
|
<memory unit='KiB'>{{ system_cfg.memory | int * 1024 }}</memory>
|
||||||
{% if system_cfg.balloon is defined and system_cfg.balloon | int > 0 %}<currentMemory>{{ system_cfg.balloon | int * 1024 }}</currentMemory>{% endif %}
|
{% if system_cfg.balloon is defined and system_cfg.balloon | int > 0 %}<currentMemory unit='KiB'>{{ system_cfg.balloon | int * 1024 }}</currentMemory>{% endif %}
|
||||||
<vcpu placement='static'>{{ system_cfg.cpus }}</vcpu>
|
<vcpu placement='static'>{{ system_cfg.cpus }}</vcpu>
|
||||||
<os>
|
<os>
|
||||||
<type arch='x86_64' machine="{{ virtualization_libvirt_machine_type }}">hvm</type>
|
<type arch='x86_64' machine="{{ virtualization_libvirt_machine_type }}">hvm</type>
|
||||||
@@ -33,17 +33,20 @@
|
|||||||
<driver name="qemu" type="raw"/>
|
<driver name="qemu" type="raw"/>
|
||||||
<source file="{{ boot_iso }}"/>
|
<source file="{{ boot_iso }}"/>
|
||||||
<target dev="sda" bus="sata"/>
|
<target dev="sda" bus="sata"/>
|
||||||
|
<readonly/>
|
||||||
</disk>
|
</disk>
|
||||||
<disk type="file" device="cdrom">
|
<disk type="file" device="cdrom">
|
||||||
<driver name="qemu" type="raw"/>
|
<driver name="qemu" type="raw"/>
|
||||||
<source file="{{ virtualization_libvirt_cloudinit_path }}"/>
|
<source file="{{ virtualization_libvirt_cloudinit_path }}"/>
|
||||||
<target dev="sdb" bus="sata"/>
|
<target dev="sdb" bus="sata"/>
|
||||||
|
<readonly/>
|
||||||
</disk>
|
</disk>
|
||||||
{% if rhel_iso is defined and rhel_iso | length > 0 %}
|
{% if rhel_iso is defined and rhel_iso | length > 0 %}
|
||||||
<disk type="file" device="cdrom">
|
<disk type="file" device="cdrom">
|
||||||
<driver name="qemu" type="raw"/>
|
<driver name="qemu" type="raw"/>
|
||||||
<source file="{{ rhel_iso }}"/>
|
<source file="{{ rhel_iso }}"/>
|
||||||
<target dev="sdc" bus="sata"/>
|
<target dev="sdc" bus="sata"/>
|
||||||
|
<readonly/>
|
||||||
</disk>
|
</disk>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% for iface in system_cfg.network.interfaces %}
|
{% for iface in system_cfg.network.interfaces %}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ disk = [
|
|||||||
]
|
]
|
||||||
vif = [
|
vif = [
|
||||||
{%- for iface in system_cfg.network.interfaces -%}
|
{%- for iface in system_cfg.network.interfaces -%}
|
||||||
'bridge={{ iface.bridge }},model=e1000'{% if not loop.last %}, {% endif %}
|
'bridge={{ iface.bridge }},model=virtio'{% if not loop.last %}, {% endif %}
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
]
|
]
|
||||||
boot = "{{ 'dc' if xen_installer_media_enabled | bool else 'c' }}"
|
boot = "{{ 'dc' if xen_installer_media_enabled | bool else 'c' }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user