--- # tasks file for ensure_repo_epel - name: include variables when: ["ansible_facts[\"system\"] == 'Linux'"] ansible.builtin.include_vars: file: '{{ lookup("first_found", findme) }}' name: ensure_repo_epel vars: findme: files: - '{{ ansible_facts["distribution"] }}-{{ ansible_facts["distribution_major_version"] }}-{{ ansible_facts["architecture"] }}.yml' - '{{ ansible_facts["distribution"] }}-{{ ansible_facts["distribution_major_version"] }}-default.yml' - '{{ ansible_facts["distribution"] }}-default.yml' - '{{ ansible_facts["os_family"] }}-{{ ansible_facts["distribution_major_version"] }}-{{ ansible_facts["architecture"] }}.yml' - '{{ ansible_facts["os_family"] }}-{{ ansible_facts["distribution_major_version"] }}-default.yml' - '{{ ansible_facts["os_family"] }}-default.yml' - default.yml paths: [../vars/] errors: ignore - name: package discovery when: - ansible_facts["system"] == 'Linux' - ansible_facts["packages"] is not defined ansible.builtin.package_facts: - name: service discovery when: - ansible_facts["system"] == 'Linux' - ansible_facts["services"] is not defined ansible.builtin.service_facts: - name: ensure packages when: - ansible_facts["system"] == 'Linux' - ensure_repo_epel is defined - ensure_repo_epel.package_list is defined - ensure_repo_epel.package_list is iterable - ansible_facts.packages[item.name] is not defined ansible.builtin.package: disable_gpg_check: '{{ item.disable_gpg_check | default(omit) }}' name: '{{ item.url }}' state: '{{ item.state }}' loop: '{{ ensure_repo_epel.package_list }}' loop_control: label: '{{ item.name }} will be {{ item.state }}' notify: [ensure_repo_epel.package_facts, ensure_repo_epel.service_facts] - name: ensure services when: - ansible_facts["system"] == 'Linux' - ensure_repo_epel is defined - ensure_repo_epel.service_list is defined - ensure_repo_epel.service_list is iterable ansible.builtin.service: enabled: '{{ item.enabled }}' name: '{{ item.name }}' state: '{{ item.state }}' loop: '{{ ensure_repo_epel.service_list }}' loop_control: label: '{{ item.name }} will be {{ item.state }}' notify: [ensure_repo_epel.package_facts, ensure_repo_epel.service_facts] - name: prioritize oracle epel repo when: - ansible_facts["system"] == 'Linux' - ansible_facts["distribution"] == 'OracleLinux' community.general.ini_file: path: "/etc/yum.repos.d/oracle-epel-ol{{ ansible_facts['distribution_major_version'] }}.repo" section: "ol{{ ansible_facts['distribution_major_version'] }}_developer_EPEL" option: priority value: '1' no_extra_spaces: true mode: '0644' create: false - name: deprioritize upstream epel repo when: - ansible_facts["system"] == 'Linux' - ansible_facts["distribution"] == 'OracleLinux' community.general.ini_file: path: "/etc/yum.repos.d/epel.repo" section: epel option: priority value: '99' no_extra_spaces: true mode: '0644' create: false - name: flush handlers ansible.builtin.meta: flush_handlers