---
# tasks file for mongodb_repository (RedHat os_family)
- name: Add mongodb.org gpgkey
  rpm_key:
    key: "{{ redhat.rpm_key_key }}"
    state: present
  register: _yum
  until: _yum is succeeded
  retries: 5
  tags:
    - "pkg"
    - "setup"
    - "mongodb"
    - "redhat"

- name: Ensure MongoDB yum repository exists
  yum_repository:
    name: "mongodb-{{ mongodb_version }}"
    description: "{{ redhat.yum_description }}"
    baseurl: "{{ redhat.yum_baseurl }}"
    gpgcheck: "{{ redhat.yum_gpgcheck }}"
    gpgkey: "{{ redhat.yum_gpgkey }}"
  register: _yum
  until: _yum is succeeded
  retries: 5
  tags:
    - "pkg"
    - "setup"
    - "mongodb"
    - "redhat"
