fix: include os specific tasks only for related os
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/push/docs Pipeline was successful
ci/woodpecker/push/notify Pipeline was successful

This commit is contained in:
Robert Kaussow 2024-09-25 21:52:07 +02:00
parent 6225ff8b72
commit e9f1db5279
Signed by: xoxys
GPG Key ID: 4E692A2EAECC03C0
2 changed files with 45 additions and 35 deletions

View File

@ -5,40 +5,15 @@
state: absent
loop: "{{ packages_uninstall_pre + packages_uninstall_pre_extra }}"
- name: Adjust dnf config file
ansible.builtin.template:
src: etc/dnf/dnf.conf.j2
dest: /etc/dnf/dnf.conf
owner: root
group: root
mode: "0644"
- name: Remove repository files
ansible.builtin.file:
name: "/etc/yum.repos.d/{{ item }}"
state: absent
loop: "{{ packages_repofiles_remove }}"
loop_control:
label: "/etc/yum.repos.d/{{ item }}"
notify: __packages_clean_metadata
- name: Add common repositories
ansible.builtin.yum_repository:
name: "{{ item.name }}"
file: "{{ item.filename | default(omit) }}"
description: "{{ item.desc | default(omit) }}"
baseurl: "{{ item.baseurl | default(omit) }}"
gpgkey: "{{ item.gpgkey | default(omit) }}"
gpgcheck: "{{ item.gpgcheck | default('yes') }}"
sslverify: "{{ item.sslverify | default('yes') }}"
enabled: "{{ item.enabled | default('yes') }}"
state: "{{ item.state | default('present') }}"
loop: "{{ packages_yum_repositories + packages_yum_repositories_extra }}"
loop_control:
label: "{{ item.name }}"
notify:
- __packages_upgrade
- __packages_clean_metadata
- name: Include OS specific tasks
ansible.builtin.include_tasks: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- "{{ ansible_os_family | lower }}.yml"
paths:
- "tasks"
errors: "ignore"
- name: Uninstall packages
ansible.builtin.package:
@ -46,7 +21,7 @@
state: absent
loop: "{{ packages_uninstall + packages_uninstall_extra }}"
- name: Install common packages
- name: Install packages
ansible.builtin.package:
name: "{{ item }}"
enablerepo: "{{ packages_enablerepo }}"

35
tasks/redhat.yml Normal file
View File

@ -0,0 +1,35 @@
---
- name: Adjust dnf config file
ansible.builtin.template:
src: etc/dnf/dnf.conf.j2
dest: /etc/dnf/dnf.conf
owner: root
group: root
mode: "0644"
- name: Remove repository files
ansible.builtin.file:
name: "/etc/yum.repos.d/{{ item }}"
state: absent
loop: "{{ packages_repofiles_remove }}"
loop_control:
label: "/etc/yum.repos.d/{{ item }}"
notify: __packages_clean_metadata
- name: Add repositories
ansible.builtin.yum_repository:
name: "{{ item.name }}"
file: "{{ item.filename | default(omit) }}"
description: "{{ item.desc | default(omit) }}"
baseurl: "{{ item.baseurl | default(omit) }}"
gpgkey: "{{ item.gpgkey | default(omit) }}"
gpgcheck: "{{ item.gpgcheck | default('yes') }}"
sslverify: "{{ item.sslverify | default('yes') }}"
enabled: "{{ item.enabled | default('yes') }}"
state: "{{ item.state | default('present') }}"
loop: "{{ packages_yum_repositories + packages_yum_repositories_extra }}"
loop_control:
label: "{{ item.name }}"
notify:
- __packages_upgrade
- __packages_clean_metadata