---
- name: Install EPEL repository
  yum:
    name: epel-release
    state: installed
  when:
    - netbox_python == 3

- name: Install required packages for selected NetBox configuration
  yum:
    name: "{{ item }}"
    state: latest
    update_cache: yes
  with_items:
    - "{{ netbox_python3_packages if (netbox_python == 3) else netbox_python2_packages }}"
    - "{{ netbox_packages }}"
    - "{{ netbox_ldap_packages if netbox_ldap_enabled else [] }}"
    - "{{ 'git' if netbox_git else [] }}"
    - python-psycopg2

---
- name: Install EPEL repository
  yum:
    name: epel-release
    state: installed

- name: Install required packages for selected NetBox configuration
  yum:
    name: "{{ item }}"
    state: latest
    update_cache: yes
  with_items:
    - "{{ netbox_python3_packages if (netbox_python == 3) else netbox_python2_packages }}"
    - "{{ netbox_packages }}"
    - "{{ netbox_ldap_packages if netbox_ldap_enabled else [] }}"
    - "{{ 'git' if netbox_git else [] }}"
    - python-psycopg2

Install EPEL on Python 2 as well
Install EPEL on Python 2 as well
