---

- name: Setup rabbitmy/erlang repo from packagecloud for RH
  become: yes
  no_log: yes
  yum_repository:
    name: rabbitmq_erlang
    description: rabbitmq_erlang
    baseurl: https://packagecloud.io/rabbitmq/erlang/el/{{ ansible_facts.distribution_major_version }}/$basearch
    repo_gpgcheck: yes
    gpgkey: "https://packagecloud.io/rabbitmq/erlang/gpgkey"
    sslcacert: /etc/pki/tls/certs/ca-bundle.crt
    metadata_expire: 300
    gpgcheck: no
    enabled: yes
    sslverify: yes
  when: ansible_facts.os_family == 'RedHat'
  tags: rabbitmq

- name: Setup rabbit repo from packagecloud for RH
  become: yes
  no_log: yes
  yum_repository:
    name: rabbitmq-server
    description: rabbitmq-server
    baseurl: https://packagecloud.io/rabbitmq/rabbitmq-server/el/{{ ansible_facts.distribution_major_version }}/$basearch
    repo_gpgcheck: yes
    gpgkey: "https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey"
    sslcacert: /etc/pki/tls/certs/ca-bundle.crt
    metadata_expire: 300
    gpgcheck: no
    enabled: yes
    sslverify: yes
  when: ansible_facts.os_family == 'RedHat'
  tags: rabbitmq

- name: Install latest erlang package on {{ ansible_facts.distribution }}
  become: yes
  package:
    name: erlang
    state: present
  register: _eltask
  retries: 5
  delay: 3
  until: _eltask is succeeded
  tags: rabbitmq

---

- name: Setup rabbitmy/erlang repo from packagecloud for RH
  become: yes
  no_log: yes
  yum_repository:
    name: rabbitmq_erlang
    description: rabbitmq_erlang
    baseurl: https://packagecloud.io/rabbitmq/erlang/el/{{ ansible_facts.distribution_major_version }}/$basearch
    repo_gpgcheck: yes
    gpgkey: "https://packagecloud.io/rabbitmq/erlang/gpgkey"
    sslcacert: /etc/pki/tls/certs/ca-bundle.crt
    metadata_expire: 300
    gpgcheck: no
    enabled: yes
    sslverify: yes
  tags: rabbitmq

- name: Setup rabbit repo from packagecloud for RH
  become: yes
  no_log: yes
  yum_repository:
    name: rabbitmq-server
    description: rabbitmq-server
    baseurl: https://packagecloud.io/rabbitmq/rabbitmq-server/el/{{ ansible_facts.distribution_major_version }}/$basearch
    repo_gpgcheck: yes
    gpgkey: "https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey"
    sslcacert: /etc/pki/tls/certs/ca-bundle.crt
    metadata_expire: 300
    gpgcheck: no
    enabled: yes
    sslverify: yes
  tags: rabbitmq

- name: Install latest erlang package on {{ ansible_facts.distribution }}
  become: yes
  package:
    name: erlang
    state: present
  register: _eltask
  retries: 5
  delay: 3
  until: _eltask is succeeded
  tags: rabbitmq

Remove redundant when check on redhat task file
Remove redundant when check on redhat task file
