Skip to content

Commit

Permalink
allow disabling/removing of repositories by setting the state parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeni committed Aug 14, 2023
1 parent 803e6d6 commit 87e1b51
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/repositories_role-state_override.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- repositories role - allow disabling/removing of repositories by setting the ``state`` parameter
8 changes: 4 additions & 4 deletions roles/repositories/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
product: "{{ item.0.name }}"
name: "{{ item.1.name }}"
all_repositories: false
state: enabled
state: "{{ item.1.state | default(omit) }}"
repositories:
- releasever: "{{ item.1.releasever | default(omit) }}"
basearch: "{{ item.1.basearch | default(omit) }}"
Expand All @@ -26,7 +26,7 @@
organization: "{{ foreman_organization }}"
label: "{{ item.1 }}"
all_repositories: true
state: enabled
state: "{{ item.1.state | default(omit) }}"
with_subelements:
- "{{ foreman_products | selectattr('all_repositories', 'defined') | selectattr('all_repositories', 'equalto', True) | list }}"
- labels
Expand All @@ -41,7 +41,7 @@
name: "{{ item.name }}"
label: "{{ item.label | default(omit) }}"
gpg_key: "{{ item.gpg_key | default(omit) }}"
state: present
state: "{{ item.state | default(omit) }}"
with_items:
- "{{ foreman_products | selectattr('repositories', 'defined') | map('combine', {'repositories': '[FILTERED]'}) | list }}"

Expand Down Expand Up @@ -81,7 +81,7 @@
ssl_ca_cert: "{{ item.1.ssl_ca_cert | default(omit) }}"
ssl_client_cert: "{{ item.1.ssl_client_cert | default(omit) }}"
ssl_client_key: "{{ item.1.ssl_client_key | default(omit) }}"
state: present
state: "{{ item.1.state | default(omit) }}"
unprotected: "{{ item.1.unprotected | default(omit) }}"
upstream_password: "{{ item.1.upstream_password | default(omit) }}"
upstream_username: "{{ item.1.upstream_username | default(omit) }}"
Expand Down

0 comments on commit 87e1b51

Please sign in to comment.