fix: include os specific tasks only for related os
This commit is contained in:
parent
6225ff8b72
commit
e9f1db5279
@ -5,40 +5,15 @@
|
|||||||
state: absent
|
state: absent
|
||||||
loop: "{{ packages_uninstall_pre + packages_uninstall_pre_extra }}"
|
loop: "{{ packages_uninstall_pre + packages_uninstall_pre_extra }}"
|
||||||
|
|
||||||
- name: Adjust dnf config file
|
- name: Include OS specific tasks
|
||||||
ansible.builtin.template:
|
ansible.builtin.include_tasks: "{{ lookup('first_found', params) }}"
|
||||||
src: etc/dnf/dnf.conf.j2
|
vars:
|
||||||
dest: /etc/dnf/dnf.conf
|
params:
|
||||||
owner: root
|
files:
|
||||||
group: root
|
- "{{ ansible_os_family | lower }}.yml"
|
||||||
mode: "0644"
|
paths:
|
||||||
|
- "tasks"
|
||||||
- name: Remove repository files
|
errors: "ignore"
|
||||||
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: Uninstall packages
|
- name: Uninstall packages
|
||||||
ansible.builtin.package:
|
ansible.builtin.package:
|
||||||
@ -46,7 +21,7 @@
|
|||||||
state: absent
|
state: absent
|
||||||
loop: "{{ packages_uninstall + packages_uninstall_extra }}"
|
loop: "{{ packages_uninstall + packages_uninstall_extra }}"
|
||||||
|
|
||||||
- name: Install common packages
|
- name: Install packages
|
||||||
ansible.builtin.package:
|
ansible.builtin.package:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
enablerepo: "{{ packages_enablerepo }}"
|
enablerepo: "{{ packages_enablerepo }}"
|
||||||
|
35
tasks/redhat.yml
Normal file
35
tasks/redhat.yml
Normal 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
|
Loading…
Reference in New Issue
Block a user