Skip to content

Commit

Permalink
Fix /etc/hosts issues on rabbit servers when using FQDN
Browse files Browse the repository at this point in the history
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 rcbops#486
  • Loading branch information
andymcc committed Aug 29, 2014
1 parent 22dd0ba commit 78ef2ca
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions rpc_deployment/roles/rabbit_common/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand All @@ -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
Expand Down

0 comments on commit 78ef2ca

Please sign in to comment.