Using the remove_yum_repos var give a list of yum repos names to remove
from /etc/yum.repos.d. This gives a way for us to clean up yum repos
that we add with this role.
Signed-off-by: Andrew Schoen <aschoen@redhat.com>
# name: "epel"
#
yum_repos: []
+
+# a list of repo names as strings to delete from /etc/yum.repos.d
+# the name should not include the .repo extension
+remove_yum_repos: []
---
- include: yum_repos.yml
+ when: yum_repos|length > 0
tags:
- yum-repos
+
+- include: remove_yum_repos.yml
+ when: remove_yum_repos|length > 0
+ tags:
+ - delete-yum-repos
--- /dev/null
+---
+- name: Delete yum repos from /etc/yum.repos.d
+ file:
+ path: "/etc/yum.repos.d/{{ item }}.repo"
+ state: absent
+ with_items: remove_yum_repos