add option to remove whole repo files
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Robert Kaussow 2019-11-21 12:49:57 +01:00
parent 1a5fc58ce3
commit 15c2048d48
2 changed files with 26 additions and 15 deletions

View File

@ -28,6 +28,8 @@ yum_repositories: []
# enabled: True # enabled: True
# @end # @end
yum_repofiles_remove: []
# @var yum_deltarpm_value:description: > # @var yum_deltarpm_value:description: >
# Configure deltarmp. To get it working you have to install `deltarpm` package first! # Configure deltarmp. To get it working you have to install `deltarpm` package first!
# Value set to `0` means disabled. A positive value defines the number # Value set to `0` means disabled. A positive value defines the number

View File

@ -1,18 +1,27 @@
--- ---
- name: Add common yum repositories - block:
yum_repository: - name: Add common yum repositories
name: "{{ item.name }}" yum_repository:
file: "{{ item.filename }}" name: "{{ item.name }}"
description: "{{ item.desc | default(omit) }}" file: "{{ item.filename }}"
baseurl: "{{ item.baseurl | default(omit) }}" description: "{{ item.desc | default(omit) }}"
gpgkey: "{{ item.gpgkey | default(omit) }}" baseurl: "{{ item.baseurl | default(omit) }}"
gpgcheck: "{{ item.gpgcheck | default('yes') }}" gpgkey: "{{ item.gpgkey | default(omit) }}"
sslverify: "{{ item.sslverify | default('yes') }}" gpgcheck: "{{ item.gpgcheck | default('yes') }}"
enabled: "{{ item.enabled | default('yes') }}" sslverify: "{{ item.sslverify | default('yes') }}"
state: "{{ item.state | default('present') }}" enabled: "{{ item.enabled | default('yes') }}"
loop: "{{ yum_repositories }}" state: "{{ item.state | default('present') }}"
loop_control: loop: "{{ yum_repositories }}"
label: "{{ item.name }}" loop_control:
notify: __yum_upgrade label: "{{ item.name }}"
notify: __yum_upgrade
- name: Remove repo files
file:
name: "/etc/yum.repos.d/{{ item }}"
state: absent
loop: "{{ yum_repofiles_remove }}"
loop_control:
label: "/etc/yum.repos.d{{ item }}"
become: True become: True
become_user: root become_user: root