<commit_before>---
- name: Gather host facts to get ansible_distribution_version ansible_distribution_major_version
  setup:
    gather_subset: '!all'
    filter: ansible_distribution_*version

- name: Add proxy to yum.conf or dnf.conf if http_proxy is defined
  ini_file:
    path: "{{ ( (ansible_distribution_major_version | int) < 8) | ternary('/etc/yum.conf','/etc/dnf/dnf.conf') }}"
    section: main
    option: proxy
    value: "{{ http_proxy | default(omit) }}"
    state: "{{ http_proxy | default(False) | ternary('present', 'absent') }}"
    no_extra_spaces: true
  become: true
  when: not skip_http_proxy_on_os_packages

# For Oracle Linux install public repo
- name: Download Oracle Linux public yum repo
  get_url:
    url: https://yum.oracle.com/public-yum-ol7.repo
    dest: /etc/yum.repos.d/public-yum-ol7.repo
  when:
    - use_oracle_public_repo|default(true)
    - '"Oracle" in os_release.stdout'
    - (ansible_distribution_version | float) < 7.6
  environment: "{{ proxy_env }}"

- name: Enable Oracle Linux repo
  ini_file:
    dest: /etc/yum.repos.d/public-yum-ol7.repo
    section: "{{ item }}"
    option: enabled
    value: "1"
  with_items:
    - ol7_latest
    - ol7_addons
    - ol7_developer_EPEL
  when:
    - use_oracle_public_repo|default(true)
    - '"Oracle" in os_release.stdout'
    - (ansible_distribution_version | float) < 7.6

- name: Enable Oracle Linux repo
  ini_file:
    dest: "/etc/yum.repos.d/oracle-linux-ol{{ ansible_distribution_major_version }}.repo"
    section: "ol{{ ansible_distribution_major_version }}_addons"
    option: "{{ item.option }}"
    value: "{{ item.value }}"
  with_items:
    - { option: "enabled", value: "1" }
    - { option: "baseurl", value: "http://yum.oracle.com/repo/OracleLinux/OL{{ ansible_distribution_major_version }}/addons/x86_64/" }
  when:
    - '"Oracle" in os_release.stdout'
    - (ansible_distribution_version | float) >= 7.6

- name: Install EPEL for Oracle Linux repo package
  package:
    name: "oracle-epel-release-el{{ ansible_distribution_major_version }}"
    state: present
  when:
    - '"Oracle" in os_release.stdout'
    - (ansible_distribution_version | float) >= 7.6

# CentOS ships with python installed

- name: Check presence of fastestmirror.conf
  stat:
    path: /etc/yum/pluginconf.d/fastestmirror.conf
  register: fastestmirror

# the fastestmirror plugin can actually slow down Ansible deployments
- name: Disable fastestmirror plugin if requested
  lineinfile:
    dest: /etc/yum/pluginconf.d/fastestmirror.conf
    regexp: "^enabled=.*"
    line: "enabled=0"<commit_msg>Ensure when use_oracle_public_repo is set to false the public Oracle Linux yum repos are not set (#7228)<commit_after>---
- name: Gather host facts to get ansible_distribution_version ansible_distribution_major_version
  setup:
    gather_subset: '!all'
    filter: ansible_distribution_*version

- name: Add proxy to yum.conf or dnf.conf if http_proxy is defined
  ini_file:
    path: "{{ ( (ansible_distribution_major_version | int) < 8) | ternary('/etc/yum.conf','/etc/dnf/dnf.conf') }}"
    section: main
    option: proxy
    value: "{{ http_proxy | default(omit) }}"
    state: "{{ http_proxy | default(False) | ternary('present', 'absent') }}"
    no_extra_spaces: true
  become: true
  when: not skip_http_proxy_on_os_packages

# For Oracle Linux install public repo
- name: Download Oracle Linux public yum repo
  get_url:
    url: https://yum.oracle.com/public-yum-ol7.repo
    dest: /etc/yum.repos.d/public-yum-ol7.repo
  when:
    - use_oracle_public_repo|default(true)
    - '"Oracle" in os_release.stdout'
    - (ansible_distribution_version | float) < 7.6
  environment: "{{ proxy_env }}"

- name: Enable Oracle Linux repo
  ini_file:
    dest: /etc/yum.repos.d/public-yum-ol7.repo
    section: "{{ item }}"
    option: enabled
    value: "1"
  with_items:
    - ol7_latest
    - ol7_addons
    - ol7_developer_EPEL
  when:
    - use_oracle_public_repo|default(true)
    - '"Oracle" in os_release.stdout'
    - (ansible_distribution_version | float) < 7.6

- name: Enable Oracle Linux repo
  ini_file:
    dest: "/etc/yum.repos.d/oracle-linux-ol{{ ansible_distribution_major_version }}.repo"
    section: "ol{{ ansible_distribution_major_version }}_addons"
    option: "{{ item.option }}"
    value: "{{ item.value }}"
  with_items:
    - { option: "enabled", value: "1" }
    - { option: "baseurl", value: "http://yum.oracle.com/repo/OracleLinux/OL{{ ansible_distribution_major_version }}/addons/x86_64/" }
  when:
    - use_oracle_public_repo|default(true)
    - '"Oracle" in os_release.stdout'
    - (ansible_distribution_version | float) >= 7.6

- name: Install EPEL for Oracle Linux repo package
  package:
    name: "oracle-epel-release-el{{ ansible_distribution_major_version }}"
    state: present
  when:
    - use_oracle_public_repo|default(true)
    - '"Oracle" in os_release.stdout'
    - (ansible_distribution_version | float) >= 7.6

# CentOS ships with python installed

- name: Check presence of fastestmirror.conf
  stat:
    path: /etc/yum/pluginconf.d/fastestmirror.conf
  register: fastestmirror

# the fastestmirror plugin can actually slow down Ansible deployments
- name: Disable fastestmirror plugin if requested
  lineinfile:
    dest: /etc/yum/pluginconf.d/fastestmirror.conf
    regexp: "^enabled=.*"
    line: "enabled=0"
{'fraction_non_alphanumeric': 0.12390207437862082, 'fraction_numerical': 0.00897028592786395, 'mean_word_length': 3.641803989592368, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1780385', 'n_tokens_mistral': 1925, 'n_tokens_neox': 1843, 'n_words': 413}