<commit_before>---
- name: Assert supported platform
  tags: util
  assert:
    that:
      - ansible_os_family in util_supported_os_families
      - ansible_distribution in util_supported_os_distributions


- name: Include OS specific vars
  tags: util
  include_vars: "{{ ansible_os_family }}.yml"

- name: Include distribution specific vars
  tags: util
  with_first_found:
    - "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
    - "{{ ansible_distribution }}.yml"
  include_vars: "{{ item }}"


- name: Assert role configuration
  tags: util
  assert:
    that:
      - util_package_state in util_package_states
      - util_init_system|default(util_init_system_default) in util_init_systems


# Manage package installation of Ansible dependencies
#   ansible_os_family == 'Debian'
- name: Update apt package cache
  tags: util
  become: true
  when: ansible_os_family == 'Debian'
  apt:
    update_cache=true
    cache_valid_time={{ util_apt_cache_valid_time }}

#   We need to install Python SELinux bindings to perform filesystem operations
#     with Ansible if SELinux is enabled
- name: Register SELinux state
  tags: util
  become: yes
  always_run: yes
  ignore_errors: true
  failed_when: false
  changed_when: false
  register: util_registered_selinux_state
  command: selinuxenabled

- name: Install Python SELinux bindings
  tags: util
  become: yes
  when: util_registered_selinux_state.rc == 0
  with_items: util_package_list_selinux
  action: "{{ ansible_pkg_mgr }} state={{ util_package_state }} name={{ item }}"


#   ansible_os_family == 'RedHat'
- name: Install EPEL
  tags: util
  become: true
  when:
    - util_epel_enable
    - ansible_os_family == 'RedHat'
  register: util_registered_install_epel
  action: "{{ ansible_pkg_mgr }} state=installed name={{ util_epel_baseurl }}/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm disable_gpg_check=yes"

- name: Update yum package cache
  tags: util
  become: true
  when: "{{ util_registered_install_epel.changed|default(false) }}"
  command: yum
      --assumeyes
      --quiet
      --enablerepo epel
      makecache

- name: Install Ansible module dependencies from EPEL
  tags: util
  become: true
  with_items: util_package_list_ansible_deps_epel<commit_msg>Add assertion on EPEL configuration<commit_after>---
- name: Assert supported platform
  tags: util
  assert:
    that:
      - ansible_os_family in util_supported_os_families
      - ansible_distribution in util_supported_os_distributions


- name: Include OS specific vars
  tags: util
  include_vars: "{{ ansible_os_family }}.yml"

- name: Include distribution specific vars
  tags: util
  with_first_found:
    - "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
    - "{{ ansible_distribution }}.yml"
  include_vars: "{{ item }}"


- name: Assert role configuration
  tags: util
  assert:
    that:
      - util_package_state in util_package_states
      - util_init_system|default(util_init_system_default) in util_init_systems

- name: Assert EPEL configuration
  tags: util
  when: ansible_local.util.epel.enable is defined
  assert:
    that:
      - util_epel_enable|bool == ansible_local.util.epel.enable|bool


# Manage package installation of Ansible dependencies
#   ansible_os_family == 'Debian'
- name: Update apt package cache
  tags: util
  become: true
  when: ansible_os_family == 'Debian'
  apt:
    update_cache=true
    cache_valid_time={{ util_apt_cache_valid_time }}


#   We need to install Python SELinux bindings to perform filesystem operations
#     with Ansible if SELinux is enabled
- name: Register SELinux state
  tags: util
  become: yes
  always_run: yes
  ignore_errors: true
  failed_when: false
  changed_when: false
  register: util_registered_selinux_state
  command: selinuxenabled

- name: Install Python SELinux bindings
  tags: util
  become: yes
  when: util_registered_selinux_state.rc == 0
  with_items: util_package_list_selinux
  action: "{{ ansible_pkg_mgr }} state={{ util_package_state }} name={{ item }}"


#   ansible_os_family == 'RedHat'
- name: Install EPEL
  tags: util
  become: true
  when:
    - util_epel_enable
    - ansible_os_family == 'RedHat'
  register: util_registered_install_epel
  yum:
    state={{ 'present' if util_epel_enable else 'absent' }}
    name={{ util_epel_baseurl }}/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm
    disable_gpg_check=true
    update_cache=true


- name: Install Ansible module dependencies from EPEL
  tags: util
  become: true
  with_items: util_package_list_ansible_deps_epel
{'fraction_non_alphanumeric': 0.08358596795149416, 'fraction_numerical': 0.00043308791684711995, 'mean_word_length': 4.092613009922823, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1595225', 'n_tokens_mistral': 1564, 'n_tokens_neox': 1501, 'n_words': 384}