Skip to content

Commit 1b2d518

Browse files
committed
bootlinux: fix OS detection for 9P delegated tasks with registered facts
Signed-off-by: Daniel Gomez <[email protected]>
1 parent 652d192 commit 1b2d518

File tree

4 files changed

+26
-8
lines changed

4 files changed

+26
-8
lines changed

playbooks/roles/bootlinux/tasks/build/9p.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
11
---
2+
- name: Gather facts from localhost for dependency installation
3+
ansible.builtin.setup:
4+
filter: "ansible_os_family,ansible_distribution"
5+
delegate_to: localhost
6+
register: localhost_facts
7+
run_once: true
8+
9+
- name: Set localhost OS facts for 9P build
10+
ansible.builtin.set_fact:
11+
localhost_os_family: "{{ localhost_facts.ansible_facts.ansible_os_family }}"
12+
localhost_distribution: "{{ localhost_facts.ansible_facts.ansible_distribution }}"
13+
delegate_to: localhost
14+
run_once: true
15+
16+
- name: Refresh target host facts after localhost gathering
17+
ansible.builtin.setup:
18+
filter: "ansible_os_family,ansible_distribution,ansible_distribution_version"
19+
220
- name: Install dependencies to build the Linux kernel
321
delegate_to: localhost
422
run_once: true

playbooks/roles/bootlinux/tasks/install-deps/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
- name: Debian-specific setup
33
ansible.builtin.import_tasks: debian/main.yml
44
when:
5-
- ansible_os_family == "Debian"
5+
- localhost_os_family == "Debian"
66

77
- name: SuSE-specific setup
88
ansible.builtin.import_tasks: suse/main.yml
99
when:
10-
- ansible_os_family == "Suse"
10+
- localhost_os_family == "Suse"
1111

1212
- name: Red Hat-specific setup
1313
ansible.builtin.import_tasks: redhat/main.yml
1414
when:
15-
- ansible_os_family == "RedHat"
15+
- localhost_os_family == "RedHat"

playbooks/roles/bootlinux/tasks/install-deps/redhat/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
ansible.builtin.include_role:
44
name: epel-release
55
when:
6-
- ansible_distribution != "Fedora"
6+
- localhost_distribution != "Fedora"
77

88
- name: Install packages we care about
99
become: true
@@ -67,7 +67,7 @@
6767
vars:
6868
packages:
6969
- btrfs-progs
70-
when: ansible_distribution == 'Fedora'
70+
when: localhost_distribution == 'Fedora'
7171

7272
- name: Install clang
7373
become: true
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
# tasks to install update-grub
33
- name: Distro specific update of your GRUB boot file
4-
ansible.builtin.import_tasks: debian.yml
4+
ansible.builtin.include_tasks: debian.yml
55
when: ansible_facts['os_family']|lower == 'debian'
6-
- ansible.builtin.import_tasks: suse.yml
6+
- ansible.builtin.include_tasks: suse.yml
77
when: ansible_facts['os_family']|lower == 'suse'
8-
- ansible.builtin.import_tasks: redhat.yml
8+
- ansible.builtin.include_tasks: redhat.yml
99
when: ansible_facts['os_family']|lower == 'redhat'

0 commit comments

Comments
 (0)