bb1fd16c75
This patch ensures that the localhost line in /etc/hosts is configured properly prior to installing and configuring RabbitMQ. Without this patch, the RabbitMQ installation often fails on CentOS 7 since RabbitMQ can't figure out its hostname. The fix in I6368b6584265084af6ff98caba68fc067b1f1f22 is reverted here because it had no effect on the /etc/hosts file. Change-Id: Ie65e5b7bcbaa1890824a93263c64e6fd04702852
70 lines
1.9 KiB
YAML
70 lines
1.9 KiB
YAML
---
|
|
# Copyright 2014, Rackspace US, Inc.
|
|
#
|
|
# 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: Remove package rabbit if found for upgrade
|
|
file:
|
|
path: "{{ rabbitmq_package_path }}"
|
|
state: absent
|
|
tags:
|
|
- rabbitmq-upgrade
|
|
- rabbitmq-package-deb
|
|
- rabbitmq-package-deb-get
|
|
- rabbitmq-package-rpm
|
|
- rabbitmq-package-rpm-get
|
|
|
|
- name: Download the RabbitMQ package
|
|
get_url:
|
|
url: "{{ rabbitmq_package_url }}"
|
|
dest: "{{ rabbitmq_package_path }}"
|
|
mode: "0644"
|
|
sha256sum: "{{ rabbitmq_package_sha256 }}"
|
|
register: package_download
|
|
retries: 3
|
|
delay: 10
|
|
until: package_download|success
|
|
tags:
|
|
- rabbitmq-package-deb
|
|
- rabbitmq-package-deb-get
|
|
- rabbitmq-package-rpm
|
|
- rabbitmq-package-rpm-get
|
|
|
|
- name: Fix /etc/hosts
|
|
lineinfile:
|
|
dest: /etc/hosts
|
|
state: present
|
|
line: "{{ hostvars[item]['ansible_ssh_host'] }} {{ hostvars[item]['ansible_hostname'] }} {{ hostvars[item]['ansible_hostname'].split('.')[0] }}"
|
|
with_items: "{{ groups[rabbitmq_host_group] }}"
|
|
tags:
|
|
- rabbitmq-config
|
|
|
|
- name: Ensure localhost /etc/hosts entry is correct
|
|
lineinfile:
|
|
dest: /etc/hosts
|
|
state: present
|
|
line: '127.0.0.1 localhost'
|
|
regexp: '^127.0.0.1'
|
|
tags:
|
|
- rabbitmq-config
|
|
|
|
- name: Create the local directories
|
|
file:
|
|
path: "/etc/rabbitmq/"
|
|
state: "directory"
|
|
group: "root"
|
|
owner: "root"
|
|
mode: "0755"
|
|
tags:
|
|
- rabbitmq-config
|