Last active
June 2, 2019 18:30
-
-
Save civik/a1ac99342c3b361312571ee6aa419f7f to your computer and use it in GitHub Desktop.
yum ansible crap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hosts: all | |
vars: | |
legit_repos: | |
- epel: { url: 'http://repo/epel', gpgcheck: 'yes', desc: 'My EPEL Repo' } | |
- core: { url: 'http://repo/core', gpgcheck: 'yes', desc: 'My core Repo' } | |
- foo: { url: 'http://repo/foo', gpgcheck: 'no', desc: 'My foo Repo' } | |
- name: Get Repository Filenames | |
find: | |
paths: /etc/yum.repos.d/ | |
patterns: *.repo | |
register: all_repos | |
- name: Get Repos to Delete | |
set_fact: | |
delete_repos: {{ all_repos | difference(legit_repos.key) }} | |
- name: Delete Bogus Repos | |
yum_repository: | |
name: {{ items }} | |
state: absent | |
with_items: {{ delete_repos }} | |
- name: Add My good repos here | |
yum_repository: | |
name: {{ item.key }} | |
baseurl: {{ item.url }} | |
gpgcheck: {{ item.gpgcheck }} | |
description: {{ item.desc }} | |
enabled: yes | |
with_items: {{ legit_repos }} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment