feat: add option to remove packages in a pre-task
This commit is contained in:
parent
b7357283e3
commit
3b5b1086cd
@ -17,6 +17,9 @@ packages_enablerepo: []
|
|||||||
packages_install: []
|
packages_install: []
|
||||||
packages_install_extra: []
|
packages_install_extra: []
|
||||||
|
|
||||||
|
packages_uninstall_pre: []
|
||||||
|
packages_uninstall_pre_extra: []
|
||||||
|
|
||||||
packages_uninstall:
|
packages_uninstall:
|
||||||
- setroubleshoot
|
- setroubleshoot
|
||||||
- mcstransd
|
- mcstransd
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Adjust packages config file
|
|
||||||
template:
|
|
||||||
src: etc/dnf/dnf.conf.j2
|
|
||||||
dest: /etc/dnf/dnf.conf
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
mode: 0644
|
|
||||||
become: True
|
|
||||||
become_user: root
|
|
@ -1,3 +1,57 @@
|
|||||||
---
|
---
|
||||||
- include_tasks: config.yml
|
- block:
|
||||||
- include_tasks: repository.yml
|
- name: Uninstall pre packages
|
||||||
|
package:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: absent
|
||||||
|
loop: "{{ packages_uninstall_pre + packages_uninstall_pre_extra }}"
|
||||||
|
|
||||||
|
- name: Adjust packages config file
|
||||||
|
template:
|
||||||
|
src: etc/dnf/dnf.conf.j2
|
||||||
|
dest: /etc/dnf/dnf.conf
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0644
|
||||||
|
|
||||||
|
- name: Remove repository files
|
||||||
|
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
|
||||||
|
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
|
||||||
|
package:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: absent
|
||||||
|
loop: "{{ packages_uninstall + packages_uninstall_extra }}"
|
||||||
|
|
||||||
|
- name: Install common packages
|
||||||
|
package:
|
||||||
|
name: "{{ item }}"
|
||||||
|
enablerepo: "{{ packages_enablerepo }}"
|
||||||
|
state: present
|
||||||
|
loop: "{{ packages_install + packages_install_extra }}"
|
||||||
|
become: True
|
||||||
|
become_user: root
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
---
|
|
||||||
- block:
|
|
||||||
- name: Remove repository files
|
|
||||||
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
|
|
||||||
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
|
|
||||||
package:
|
|
||||||
name: "{{ item }}"
|
|
||||||
enablerepo: "{{ packages_enablerepo }}"
|
|
||||||
state: absent
|
|
||||||
loop: "{{ packages_uninstall + packages_uninstall_extra }}"
|
|
||||||
|
|
||||||
- name: Install common packages
|
|
||||||
package:
|
|
||||||
name: "{{ item }}"
|
|
||||||
enablerepo: "{{ packages_enablerepo }}"
|
|
||||||
state: present
|
|
||||||
loop: "{{ packages_install + packages_install_extra }}"
|
|
||||||
become: True
|
|
||||||
become_user: root
|
|
Loading…
Reference in New Issue
Block a user