Fix /etc/hosts issues on rabbit servers when using FQDN

Rabbit occassionally fails to start because it can't resolve its "short
name"

The /etc/hosts file is dropped after the install phase, which starts up
rabbit automatically - Moving the /etc/hosts file correction to happen
before the install phase will resolve this.

Fixes #39
This commit is contained in:
Andy McCrae 2014-08-29 15:31:58 +01:00
parent 22dd0baba7
commit 53a3844bc4

View File

@ -31,6 +31,16 @@
- package_install
- rabbit_install
- name: Fix /etc/hosts
lineinfile:
dest: /etc/hosts
state: present
line: "{{ hostvars[item]['container_address'] }} {{ hostvars[item]['container_name'] }} {{ hostvars[item]['container_name'].split('.')[0] }}"
with_items: groups['rabbit']
tags:
- hosts
- rabbit_config
- name: Install rabbit packages
apt:
pkg: "{{ item }}"
@ -43,16 +53,6 @@
- package_install
- rabbit_install
- name: Fix /etc/hosts
lineinfile:
dest: /etc/hosts
state: present
line: "{{ hostvars[item]['container_address'] }} {{ hostvars[item]['container_name'] }} {{ hostvars[item]['container_name'].split('.')[0] }}"
with_items: groups['rabbit']
tags:
- hosts
- rabbit_config
- include: restart_rabbit.yml
- name: Read rabbit cookie