Migrated from legacy playbook repo into Ansible collection format: Roles (171 total): - common: 44 roles (fact gathering, SSH setup, utilities) - configuration: 32 roles (system config, networking, satellite) - provisioning: 16 roles (VMware, Azure, physical server deployment) - security: 15 roles (OpenSCAP hardening, certificates, AD integration) - monitoring: 12 roles (Zabbix, logging agents, metrics) - networking: 12 roles (DNS, DHCP, network interfaces) - satellite: 4 roles (Pulp/Satellite management) - misc: 36 roles (various utilities) Playbooks (159 total): - provisioning: 14 playbooks - azure: 13 playbooks - configuration: 22 playbooks - maintenance: 10 playbooks - security: 10 playbooks - monitoring: 9 playbooks - vcenter: 6 playbooks - networking: 7 playbooks - misc: 65 playbooks
32 lines
1005 B
YAML
32 lines
1005 B
YAML
---
|
|
# tasks file for enforce-repos
|
|
- name: Gather list of all repos, based on installed packages
|
|
ansible.builtin.shell: sudo dnf list --installed | grep -E '.+\@.+' | sed -E 's/.+\@(\S+)/\1/;s/ +//' | sort | uniq
|
|
register: used_repos
|
|
|
|
- name: Get all subscription manager repos on host
|
|
ansible.builtin.shell: "sudo subscription-manager repos | grep -E 'Repo ID: ' | sed -E 's/.+:\\s+(\\S+)$/\\1/'"
|
|
register: available_repos
|
|
|
|
- name: Create new list of repos to enable
|
|
ansible.builtin.set_fact:
|
|
repos_to_enable: "{{ (used_repos.stdout_lines | list) | intersect(available_repos.stdout_lines | list) }}"
|
|
|
|
- name: Output used_repos list
|
|
ansible.builtin.debug:
|
|
var: used_repos
|
|
|
|
- name: Output available_repos list
|
|
ansible.builtin.debug:
|
|
var: available_repos
|
|
|
|
- name: Output the unique list
|
|
ansible.builtin.debug:
|
|
var: repos_to_enable
|
|
|
|
- name: Enable all disabled baseline repos
|
|
community.general.rhsm_repository:
|
|
name: "{{ repos_to_enable | list }}"
|
|
state: enabled
|
|
|