---

- name: Configure repositories
  yum_repository:
    file: "{{ item.file }}"
    description: "AlmaLinux {{ item.name }}"
    name: "{{ item.name }}"
    baseurl: https://repo.almalinux.org/almalinux/$releasever/{{ item.dir }}/$basearch/os/
    gpgcheck: True
    gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
    enabled: "{{ item.enabled | default(True) }}"
  loop:
    - name: baseos
      file: almalinux
      dir: BaseOS
    - name: appstream
      file: almalinux
      dir: AppStream
    - name: extras
      file: almalinux
      dir: extras
    - name: powertools
      file: almalinux-powertools
      dir: PowerTools
  tags: repo

- name: Remove obsolete repo
  file: path=/etc/yum.repos.d/{{ item }}.repo state=absent
  loop:
    - fws
  tags: repo

- include_tasks: epel_{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml
  tags: always

- include_tasks: dbd_{{ ansible_os_family }}.yml
  tags: always

- include_tasks: postgres_client_{{ ansible_os_family }}.yml
  tags: always
