bifrost/playbooks/roles/bifrost-rabbitmq/tasks/main.yml

63 lines
2.1 KiB
YAML

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
- name: Install RabbitMQ package
package:
name: "{{ rabbitmq_package }}"
state: present
when: not skip_package_install | bool
- name: "Ensure /etc/hosts has good defaults"
lineinfile:
dest: "/etc/hosts"
regexp: "{{ item.regexp }}.*({{ ansible_hostname }}|localhost).*"
line: "{{ item.contents }}"
with_items:
- { regexp: '^127\.0\.0\.1', contents: '127.0.0.1 {{ ansible_hostname }} {{ ansible_fqdn }} localhost' }
- { regexp: '^::1', contents: '::1 {{ ansible_hostname }} {{ ansible_fqdn }} localhost ipv6-localhost ipv6-loopback' }
when: not skip_bootstrap | bool
# NOTE(hwoarang): The erlang SUSE package forces epmd to listen on localhost
# address which breaks rabbitmq-server when listening on a different address.
# https://build.opensuse.org/package/view_file/devel:languages:erlang:Factory/erlang/README.SUSE?expand=1
- name: "Make epmd listen to all addresses on SUSE"
block:
- blockinfile:
dest: "/etc/systemd/system/epmd.socket.d/port.conf"
content: |
[Socket]
ListenStream=
ListenStream=0.0.0.0:4369
create: yes
marker: "# {mark} ANSIBLE MANAGED BLOCK"
- systemd: daemon_reload=yes
- service: name={{ item }} state=stopped enabled=no
with_items:
- epmd.socket
- epmd
when:
- ansible_os_family == 'Suse'
- not skip_bootstrap | bool
- import_tasks: start.yml
when: not skip_start | bool
- name: "Ensure guest user is removed from rabbitmq"
rabbitmq_user:
user: "guest"
state: absent
force: yes
when: not skip_bootstrap | bool