diff --git a/roles/rabbitmq/tasks/main.yml b/roles/rabbitmq/tasks/main.yml index baae443..cf9e18e 100644 --- a/roles/rabbitmq/tasks/main.yml +++ b/roles/rabbitmq/tasks/main.yml @@ -18,6 +18,17 @@ name: os tags: install_base_os_packages +- name: Gather service facts + ansible.builtin.service_facts: + +- name: Stop rabbitmq service + ansible.builtin.service: + name: rabbitmq-server + state: stopped + when: + - ansible_facts.services["rabbitmq-server.service"] is defined + - ansible_facts.services["rabbitmq-server.service"].state == "running" + - name: Include tasks to install RabbitMQ (online) ansible.builtin.include_tasks: file: rabbitmq-online.yml @@ -61,12 +72,8 @@ ansible.builtin.include_tasks: file: configure-clustering.yml when: rabbitmq_cluster | bool - tags: rabbitmq_cluster # Check if firewalld is running, if it is then open the appropriate ports -- name: Gather service facts - ansible.builtin.service_facts: - - name: Open Port on FirewallD Public Zone ansible.posix.firewalld: port: "{{ item }}" @@ -152,7 +159,6 @@ ansible.builtin.include_tasks: file: enable-clustering.yml when: rabbitmq_cluster | bool - tags: rabbitmq_cluster - name: Get installed erlang version ansible.builtin.command: