Ansible/roles/sensu.sensu/tasks/CentOS/rabbit.yml

67 lines
1.8 KiB
YAML
Raw Normal View History

---
# tasks/CentOS/rabbit.yml: Deploy RabbitMQ
# Specific to CentOS
- name: Include ansible_distribution vars
include_vars:
file: "{{ ansible_distribution }}.yml"
tags: rabbitmq
- name: Configure RabbitMQ GPG keys in the RPM keyring
tags: rabbitmq
rpm_key:
key: "{{ sensu_rabbitmq_signing_key }}"
state: present
register: sensu_rabbitmq_import_key
- name: Add RabbitMQ's repo
tags: rabbitmq
yum_repository:
name: rabbitmq
description: rabbitmq
baseurl: "{{ sensu_rabbitmq_baseurl }}"
gpgcheck: yes
gpgkey: "{{ sensu_rabbitmq_signing_key }}"
repo_gpgcheck: no
- name: Add RabbitMQ's Erlang repo
tags: rabbitmq
yum_repository:
name: rabbitmq-erlang
description: rabbitmq-erlang
baseurl: "{{ sensu_rabbitmq_erlang_baseurl }}"
gpgcheck: yes
gpgkey: "{{ sensu_rabbitmq_erlang_signing_key }}"
repo_gpgcheck: no
# HACK: https://github.com/ansible/ansible/issues/20711#issuecomment-306260869
# Can be removed once we're running w/ a version of Ansible that has https://github.com/ansible/ansible/pull/35989
- name: Make yum cache to import GPG keys
tags: rabbitmq
command: "yum -q makecache -y --disablerepo='*' --enablerepo='{{ item }}'"
args:
warn: false
when: sensu_rabbitmq_import_key.changed
loop:
- rabbitmq
- rabbitmq-erlang
# Hard dependency for rabbitmq-server, however, typically comes from EPEL, so
# we simply install it here, as we purposely disable epel when installing rabbitmq
# causing dependency issues during installs
- name: Ensure socat is installed
tags: rabbitmq
yum:
name: socat
state: present
- name: Ensure Erlang & RabbitMQ are installed
tags: rabbitmq
yum:
name:
- erlang
- rabbitmq-server
state: present
enablerepo: rabbitmq,rabbitmq-erlang
disablerepo: epel