From bac35ee23d4f7451da3c8c0c4dfd4e2260dfec56 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Fri, 27 Feb 2026 19:28:12 +0100 Subject: [PATCH] refactor(dev-fakeroot): extract 01_core tasks --- roles/dev-fakeroot/tasks/01_core.yml | 29 ++++++++++++++++++++++++ roles/dev-fakeroot/tasks/main.yml | 34 ++-------------------------- 2 files changed, 31 insertions(+), 32 deletions(-) create mode 100644 roles/dev-fakeroot/tasks/01_core.yml diff --git a/roles/dev-fakeroot/tasks/01_core.yml b/roles/dev-fakeroot/tasks/01_core.yml new file mode 100644 index 0000000000..e4f5542ef0 --- /dev/null +++ b/roles/dev-fakeroot/tasks/01_core.yml @@ -0,0 +1,29 @@ +- name: Resolve fakeroot package names for current distribution + ansible.builtin.set_fact: + dev_fakeroot_packages: >- + {{ + DEV_FAKEROOT_PACKAGES_BY_DISTRIBUTION[ansible_facts['distribution']] + if ansible_facts['distribution'] in DEV_FAKEROOT_PACKAGES_BY_DISTRIBUTION + else [] + }} + +- name: Fail for unsupported distribution in dev-fakeroot role + ansible.builtin.assert: + that: + - (dev_fakeroot_packages | length) > 0 + fail_msg: >- + Unsupported distribution for dev-fakeroot role: {{ ansible_facts['distribution'] }} + ({{ ansible_facts['os_family'] }}). + +- name: Enable EPEL on CentOS Stream (required for fakeroot package) + ansible.builtin.package: + name: epel-release + state: present + when: ansible_facts['distribution'] in ['CentOS', 'CentOS Stream'] + +- name: Install fakeroot package(s) + ansible.builtin.package: + name: "{{ dev_fakeroot_packages }}" + state: present + +- include_tasks: utils/once/flag.yml diff --git a/roles/dev-fakeroot/tasks/main.yml b/roles/dev-fakeroot/tasks/main.yml index 5952ede182..657f317b82 100644 --- a/roles/dev-fakeroot/tasks/main.yml +++ b/roles/dev-fakeroot/tasks/main.yml @@ -1,32 +1,2 @@ ---- -- when: run_once_dev_fakeroot is not defined - block: - - name: Resolve fakeroot package names for current distribution - ansible.builtin.set_fact: - dev_fakeroot_packages: >- - {{ - DEV_FAKEROOT_PACKAGES_BY_DISTRIBUTION[ansible_facts['distribution']] - if ansible_facts['distribution'] in DEV_FAKEROOT_PACKAGES_BY_DISTRIBUTION - else [] - }} - - - name: Fail for unsupported distribution in dev-fakeroot role - ansible.builtin.assert: - that: - - (dev_fakeroot_packages | length) > 0 - fail_msg: >- - Unsupported distribution for dev-fakeroot role: {{ ansible_facts['distribution'] }} - ({{ ansible_facts['os_family'] }}). - - - name: Enable EPEL on CentOS Stream (required for fakeroot package) - ansible.builtin.package: - name: epel-release - state: present - when: ansible_facts['distribution'] in ['CentOS', 'CentOS Stream'] - - - name: Install fakeroot package(s) - ansible.builtin.package: - name: "{{ dev_fakeroot_packages }}" - state: present - - - include_tasks: utils/once/flag.yml +- include_tasks: 01_core.yml + when: run_once_dev_fakeroot is not defined \ No newline at end of file