From 30612d3c82f775fe4dc453cc52faa9abaf001dd1 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Wed, 25 Sep 2024 22:27:12 +0200 Subject: [PATCH] fix: fix os specific tasks --- tasks/debian.yml | 12 ++++++++++++ tasks/main.yml | 24 +++++------------------- tasks/redhat.yml | 13 +++++++++++++ 3 files changed, 30 insertions(+), 19 deletions(-) create mode 100644 tasks/debian.yml diff --git a/tasks/debian.yml b/tasks/debian.yml new file mode 100644 index 0000000..1ee39e4 --- /dev/null +++ b/tasks/debian.yml @@ -0,0 +1,12 @@ +--- +- name: Uninstall packages + ansible.builtin.package: + name: "{{ item }}" + state: absent + loop: "{{ packages_uninstall + packages_uninstall_extra }}" + +- name: Install common packages + ansible.builtin.package: + name: "{{ item }}" + state: present + loop: "{{ packages_install + packages_install_extra }}" diff --git a/tasks/main.yml b/tasks/main.yml index f76d287..70c592c 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -6,24 +6,10 @@ loop: "{{ packages_uninstall_pre + packages_uninstall_pre_extra }}" - name: Include OS specific tasks - ansible.builtin.include_tasks: - file: "{{ item }}" - with_first_found: - - paths: - - "tasks" + ansible.builtin.include_tasks: "{{ lookup('first_found', params) }}" + vars: + params: files: - "{{ ansible_os_family | lower }}.yml" - skip: True - -- name: Uninstall packages - ansible.builtin.package: - name: "{{ item }}" - state: absent - loop: "{{ packages_uninstall + packages_uninstall_extra }}" - -- name: Install packages - ansible.builtin.package: - name: "{{ item }}" - enablerepo: "{{ packages_enablerepo }}" - state: present - loop: "{{ packages_install + packages_install_extra }}" + paths: + - "tasks" diff --git a/tasks/redhat.yml b/tasks/redhat.yml index 1c85dfb..626cb68 100644 --- a/tasks/redhat.yml +++ b/tasks/redhat.yml @@ -33,3 +33,16 @@ notify: - __packages_upgrade - __packages_clean_metadata + +- name: Uninstall packages + ansible.builtin.package: + name: "{{ item }}" + state: absent + loop: "{{ packages_uninstall + packages_uninstall_extra }}" + +- name: Install common packages + ansible.builtin.package: + name: "{{ item }}" + enablerepo: "{{ packages_enablerepo }}" + state: present + loop: "{{ packages_install + packages_install_extra }}"