From b726d013ad371610036ff41fa07a20c4901841dd Mon Sep 17 00:00:00 2001 From: Nestor Acuna Blanco Date: Wed, 16 Oct 2024 10:55:14 +0200 Subject: [PATCH] feat: multiarch fedora template. Fedora offers images for a variety of architectures, which can be included as a template parameter. Within the template, there is a specific parameter for defining the architecture. For the sake of simplicity, I have currently set the host architecture. Signed-off-by: Nestor Acuna Blanco --- generate-templates.yaml | 4 ++-- templates/fedora.tpl.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/generate-templates.yaml b/generate-templates.yaml index b8c73893..10467e21 100644 --- a/generate-templates.yaml +++ b/generate-templates.yaml @@ -229,8 +229,8 @@ - name: Load Fedora containerdisk and image urls set_fact: - fedora_containerdisk_urls: "{{ fedora_containerdisk_urls |default([]) + lookup('osinfo', item) |attr('image_list') |selectattr('architecture', 'eq', 'x86_64') |selectattr('format', 'eq', 'containerdisk') |map(attribute='url') |map('replace', 'docker://', '') |list }}" - fedora_image_urls: "{{ fedora_image_urls |default([]) + lookup('osinfo', item) |attr('image_list') |selectattr('architecture', 'eq', 'x86_64') |selectattr('format', 'in', ['raw', 'qcow2']) |map(attribute='url') |list }}" + fedora_containerdisk_urls: "{{ fedora_containerdisk_urls |default([]) + lookup('osinfo', item) |attr('image_list') |selectattr('architecture', 'eq', ansible_architecture) |selectattr('format', 'eq', 'containerdisk') |map(attribute='url') |map('replace', 'docker://', '') |list }}" + fedora_image_urls: "{{ fedora_image_urls |default([]) + lookup('osinfo', item) |attr('image_list') |selectattr('architecture', 'eq', ansible_architecture) |selectattr('format', 'in', ['raw', 'qcow2']) |map(attribute='url') |list }}" loop: "{{ fedora_labels }}" - name: Generate Fedora templates diff --git a/templates/fedora.tpl.yaml b/templates/fedora.tpl.yaml index 61b47841..990d55cd 100644 --- a/templates/fedora.tpl.yaml +++ b/templates/fedora.tpl.yaml @@ -95,7 +95,7 @@ objects: kubevirt.io/domain: ${NAME} kubevirt.io/size: {{ item.flavor }} spec: - architecture: amd64 + architecture: "{{ 'amd64' if ansible_architecture == 'x86_64' else ansible_architecture }}" domain: features: smm: