Fix setup for CoreOS

This commit is contained in:
2026-06-15 00:16:45 +02:00
parent 9c0fcde94e
commit 211ebc15e9
7 changed files with 73 additions and 37 deletions
@@ -1,5 +1,4 @@
---
- name: Define image URLs
set_fact:
os_images:
@@ -43,6 +42,21 @@
- name: Provision VM using virt-install
shell: |
{% if os_type == 'coreos' or os_type == 'flatcar' %}
virt-install \
--connect qemu:///system \
--name {{ vm_name }} \
--vcpus {{ cpu | default(default_cpu) }} \
--memory {{ ram | default(default_ram) }} \
--disk size={{ disk | default('10G') }},backing_store={{ vm_images_dir }}/{{ vm_name }}.qcow2,backing_format=qcow2 \
--boot hd \
--os-variant {{ os_variant }} \
--network network=default \
--graphics none \
--noautoconsole \
--boot uefi \
--sysinfo type=fwcfg,entry0.name=opt/com.coreos/config,entry0.file={{ vm_images_dir }}/{{ vm_name }}.ign
{% elif os_type == 'microos' %}
virt-install \
--name {{ vm_name }} \
--vcpus {{ cpu | default(default_cpu) }} \
@@ -54,16 +68,7 @@
--graphics none \
--noautoconsole \
--boot uefi \
{% if os_type == 'coreos' or os_type == 'flatcar' %}
--cloud-init user-data=/tmp/{{ vm_name }}_ignition.json
{% elif os_type == 'microos' %}
--cloud-init user-data=/tmp/{{ vm_name }}_user-data
--cloud-init user-data={{ vm_images_dir }}/{{ vm_name }}_user-data,meta-data={{ vm_images_dir }}/{{ vm_name }}_meta-data
{% endif %}
args:
creates: "/etc/libvirt/qemu/{{ vm_name }}.xml"
- name: Attach configuration to VM
debug:
msg: "Configuration is now handled by virt-install --cloud-init flag."
when: false # This task is now obsolete
become: yes
creates: "/etc/libvirt/qemu/{{ vm_name }}.xml"