Don't fix /etc/hosts if Rabbit is disabled

The changes to /etc/hosts are required to ensure that the system's
hostname resolves to the IP address used by RabbitMQ. Without this
Rabbit gets upset. If we're not installing RabbitMQ, we don't need to do
it.

Change-Id: Iecf3dcef2a22565dd6183890302d1e9b3ad7c228
This commit is contained in:
Mark Goddard 2019-04-09 15:36:26 +01:00
parent 28fc30fd31
commit 9fcbb420ee
2 changed files with 10 additions and 9 deletions

View File

@ -27,15 +27,6 @@
enable_venv: true
when: lookup('env', 'VENV') | length > 0
- 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' }
# NOTE(sean-k-mooney) only the RabbitMQ server and MySQL db are started
# during bootstrapping. all other services are started in the Start phase.
- name: "Start database service"

View File

@ -17,6 +17,16 @@
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