public inbox for kdevops@lists.linux.dev
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: Daniel Gomez <da.gomez@kernel.org>, Luis Chamberlain <mcgrof@kernel.org>
Cc: kdevops@lists.linux.dev, Daniel Gomez <da.gomez@samsung.com>
Subject: Re: [PATCH 09/14] bootlinux: fix os detection for 9p delegated tasks with registered facts
Date: Tue, 28 Oct 2025 14:51:48 -0400	[thread overview]
Message-ID: <a319eeb2-ba9e-4625-87b1-35a7fe7717da@oracle.com> (raw)
In-Reply-To: <20251028-fedora-on-debian-v1-9-1802ab2f993a@samsung.com>

On 10/28/25 2:11 PM, Daniel Gomez wrote:
> From: Daniel Gomez <da.gomez@samsung.com>
> 
> When using 9P builds, the Linux kernel is built once on the control
> host (delegate_to: localhost, run_once: true) and shared to all guests.
> The dependency installation tasks reference ansible_os_family which
> gets overwritten when gathering facts from localhost, causing the wrong
> distribution's packages to be installed.

Just curious: Doesn't kdevops already have variables (eg, distro_debian)
that contain this state?


> Register localhost facts to separate variables (localhost_os_family,
> localhost_distribution) and refresh target host facts afterward to
> ensure both contexts have correct values. Update all OS-specific
> conditionals in install-deps to use the localhost_* variables since
> packages are installed on the control host, not the target guests.
> 
> Change import_tasks to include_tasks in update-grub since the
> conditionals reference runtime facts that aren't available at parse
> time.
> 
> Generated-by: Claude AI
> Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
> ---
>  playbooks/roles/bootlinux/tasks/build/9p.yml           | 18 ++++++++++++++++++
>  playbooks/roles/bootlinux/tasks/install-deps/main.yml  |  6 +++---
>  .../roles/bootlinux/tasks/install-deps/redhat/main.yml |  4 ++--
>  playbooks/roles/bootlinux/tasks/update-grub/main.yml   |  6 +++---
>  4 files changed, 26 insertions(+), 8 deletions(-)
> 
> diff --git a/playbooks/roles/bootlinux/tasks/build/9p.yml b/playbooks/roles/bootlinux/tasks/build/9p.yml
> index f390f028..01c95cb7 100644
> --- a/playbooks/roles/bootlinux/tasks/build/9p.yml
> +++ b/playbooks/roles/bootlinux/tasks/build/9p.yml
> @@ -1,4 +1,22 @@
>  ---
> +- name: Gather facts from localhost for dependency installation
> +  ansible.builtin.setup:
> +    filter: "ansible_os_family,ansible_distribution"
> +  delegate_to: localhost
> +  register: localhost_facts
> +  run_once: true
> +
> +- name: Set localhost OS facts for 9P build
> +  ansible.builtin.set_fact:
> +    localhost_os_family: "{{ localhost_facts.ansible_facts.ansible_os_family }}"
> +    localhost_distribution: "{{ localhost_facts.ansible_facts.ansible_distribution }}"
> +  delegate_to: localhost
> +  run_once: true
> +
> +- name: Refresh target host facts after localhost gathering
> +  ansible.builtin.setup:
> +    filter: "ansible_os_family,ansible_distribution,ansible_distribution_version"
> +
>  - name: Install dependencies to build the Linux kernel
>    delegate_to: localhost
>    run_once: true
> diff --git a/playbooks/roles/bootlinux/tasks/install-deps/main.yml b/playbooks/roles/bootlinux/tasks/install-deps/main.yml
> index 51a20741..9a9af005 100644
> --- a/playbooks/roles/bootlinux/tasks/install-deps/main.yml
> +++ b/playbooks/roles/bootlinux/tasks/install-deps/main.yml
> @@ -2,14 +2,14 @@
>  - name: Debian-specific setup
>    ansible.builtin.import_tasks: debian/main.yml
>    when:
> -    - ansible_os_family == "Debian"
> +    - localhost_os_family == "Debian"
>  
>  - name: SuSE-specific setup
>    ansible.builtin.import_tasks: suse/main.yml
>    when:
> -    - ansible_os_family == "Suse"
> +    - localhost_os_family == "Suse"
>  
>  - name: Red Hat-specific setup
>    ansible.builtin.import_tasks: redhat/main.yml
>    when:
> -    - ansible_os_family == "RedHat"
> +    - localhost_os_family == "RedHat"
> diff --git a/playbooks/roles/bootlinux/tasks/install-deps/redhat/main.yml b/playbooks/roles/bootlinux/tasks/install-deps/redhat/main.yml
> index 7f1955bf..589b0b18 100644
> --- a/playbooks/roles/bootlinux/tasks/install-deps/redhat/main.yml
> +++ b/playbooks/roles/bootlinux/tasks/install-deps/redhat/main.yml
> @@ -3,7 +3,7 @@
>    ansible.builtin.include_role:
>      name: epel-release
>    when:
> -    - ansible_distribution != "Fedora"
> +    - localhost_distribution != "Fedora"
>  
>  - name: Install packages we care about
>    become: true
> @@ -67,7 +67,7 @@
>    vars:
>      packages:
>        - btrfs-progs
> -  when: ansible_distribution == 'Fedora'
> +  when: localhost_distribution == 'Fedora'
>  
>  - name: Install clang
>    become: true
> diff --git a/playbooks/roles/bootlinux/tasks/update-grub/main.yml b/playbooks/roles/bootlinux/tasks/update-grub/main.yml
> index d0455b00..b05996bf 100644
> --- a/playbooks/roles/bootlinux/tasks/update-grub/main.yml
> +++ b/playbooks/roles/bootlinux/tasks/update-grub/main.yml
> @@ -1,9 +1,9 @@
>  ---
>  # tasks to install update-grub
>  - name: Distro specific update of your GRUB boot file
> -  ansible.builtin.import_tasks: debian.yml
> +  ansible.builtin.include_tasks: debian.yml
>    when: ansible_facts['os_family']|lower == 'debian'
> -- ansible.builtin.import_tasks: suse.yml
> +- ansible.builtin.include_tasks: suse.yml
>    when: ansible_facts['os_family']|lower == 'suse'
> -- ansible.builtin.import_tasks: redhat.yml
> +- ansible.builtin.include_tasks: redhat.yml
>    when: ansible_facts['os_family']|lower == 'redhat'
> 


-- 
Chuck Lever

  reply	other threads:[~2025-10-28 18:51 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-28 18:11 [PATCH 00/14] Fedora on Debian Daniel Gomez
2025-10-28 18:11 ` [PATCH 01/14] base_image: restore locales-all installation for Debian Trixie Daniel Gomez
2025-10-28 18:11 ` [PATCH 02/14] guestfs: fix Kconfig indentation style Daniel Gomez
2025-10-28 18:11 ` [PATCH 03/14] guestfs: remove unused bringup debug Kconfig options Daniel Gomez
2025-10-28 18:11 ` [PATCH 04/14] guestfs: fix spelling errors and Debian capitalization Daniel Gomez
2025-10-28 18:11 ` [PATCH 05/14] base_image: set selinux to permissive for fedora on debian hosts Daniel Gomez
2025-10-28 18:11 ` [PATCH 06/14] ansible_provisioning: fix help text indentation style Daniel Gomez
2025-10-28 18:11 ` [PATCH 07/14] devconfig: fix undefined custom repos/packages variables Daniel Gomez
2025-10-28 18:11 ` [PATCH 08/14] devconfig: fix Ansible boolean conditional for custom repos Daniel Gomez
2025-10-28 18:11 ` [PATCH 09/14] bootlinux: fix os detection for 9p delegated tasks with registered facts Daniel Gomez
2025-10-28 18:51   ` Chuck Lever [this message]
2025-10-28 19:53     ` Daniel Gomez
2025-10-28 19:57       ` Chuck Lever
2025-10-28 18:11 ` [PATCH 10/14] guestfs: generate dedora distribution-specific hostname prefixes Daniel Gomez
2025-10-28 18:11 ` [PATCH 11/14] defconfigs: add fedora-41 fragment for guestfs Daniel Gomez
2025-10-28 18:11 ` [PATCH 12/14] defconfigs: add debian-13 " Daniel Gomez
2025-10-28 18:11 ` [PATCH 13/14] github: add guest OS selection for CI testing Daniel Gomez
2025-10-28 18:11 ` [PATCH 14/14] guestfs: increase SSH config timeout for Fedora on Debian hosts Daniel Gomez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a319eeb2-ba9e-4625-87b1-35a7fe7717da@oracle.com \
    --to=chuck.lever@oracle.com \
    --cc=da.gomez@kernel.org \
    --cc=da.gomez@samsung.com \
    --cc=kdevops@lists.linux.dev \
    --cc=mcgrof@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox