From 9fcbb420eea2b4f9bc1dddb54593b741df1d6311 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Tue, 9 Apr 2019 15:36:26 +0100 Subject: [PATCH] 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 --- .../roles/bifrost-ironic-install/tasks/bootstrap.yml | 9 --------- playbooks/roles/bifrost-rabbitmq/tasks/main.yml | 10 ++++++++++ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml b/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml index 25944c1e0..b11f8ecf9 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml @@ -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" diff --git a/playbooks/roles/bifrost-rabbitmq/tasks/main.yml b/playbooks/roles/bifrost-rabbitmq/tasks/main.yml index 3f5574069..bf93fd848 100644 --- a/playbooks/roles/bifrost-rabbitmq/tasks/main.yml +++ b/playbooks/roles/bifrost-rabbitmq/tasks/main.yml @@ -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