---

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

# fastestmirror plugin actually slows down Ansible deployments
- name: Disable fastestmirror plugin
  lineinfile:
    dest: /etc/yum/pluginconf.d/fastestmirror.conf
    regexp: "^enabled=.*"
    line: "enabled=0"
    state: present
  when: fastestmirror.stat.exists

- name: Install packages requirements for bootstrap
  action:
    module: "{{ ansible_pkg_mgr }}"
    name: "{{ item }}"
    state: latest
  register: bs_pkgs_task_result
  until: bs_pkgs_task_result|succeeded
  retries: 4
  delay: "{{ retry_stagger | random + 3 }}"
  with_items: "libselinux-python"

