3fca0d00a9
The admin network is intended for remote admin access to the overcloud hosts e.g SSH. If admin_oc_net_name is not set it will default to provision_oc_net_name for backwards compatability. Story: 2002096 Task: 19774 Change-Id: Ib04bbc07f97218d7503000cc363624c60c287822
62 lines
2.3 KiB
YAML
62 lines
2.3 KiB
YAML
---
|
|
# For some currently unknown reason, overcloud hosts end up with multiple
|
|
# entries in /etc/hosts that map their own hostname to their admin
|
|
# network IP address, in addition to one that maps their own hostname to their
|
|
# internal network IP address. This causes RabbitMQ upgrades to fail, as
|
|
# RabbitMQ expects the system's hostname to resolve to the IP address on
|
|
# which it is listening. As a workaround, we remove the stale entries from
|
|
# /etc/hosts. See https://github.com/stackhpc/kayobe/issues/14.
|
|
|
|
- name: Ensure overcloud hosts' /etc/hosts does not contain admin network IP
|
|
hosts: overcloud
|
|
tags:
|
|
- etc-hosts-fixup
|
|
tasks:
|
|
- name: Ensure overcloud hosts' /etc/hosts does not contain admin network or loopback IPs
|
|
lineinfile:
|
|
dest: /etc/hosts
|
|
regexp: "^{{ item }}[ \t]*{{ inventory_hostname }}"
|
|
state: absent
|
|
with_items:
|
|
- "127.0.0.1"
|
|
- "{{ admin_oc_net_name | net_ip }}"
|
|
when: admin_oc_net_name | net_ip != None
|
|
become: True
|
|
|
|
- name: Ensure rabbitmq containers' /etc/hosts does not contain admin network or loopback IPs
|
|
hosts: overcloud
|
|
tags:
|
|
- etc-hosts-fixup
|
|
vars:
|
|
rabbitmq_containers:
|
|
- rabbitmq
|
|
- outward_rabbitmq
|
|
tasks:
|
|
- block:
|
|
- name: Check whether rabbitmq container is running
|
|
command: docker inspect -f {{ '{{.Id}}' }} {{ item }}
|
|
changed_when: False
|
|
failed_when: False
|
|
with_items: "{{ rabbitmq_containers }}"
|
|
register: ps_result
|
|
|
|
- name: Ensure rabbitmq containers' /etc/hosts does not contain admin network or loopback IPs
|
|
command: >
|
|
docker exec -u root {{ item.0.item }}
|
|
bash -c
|
|
'cp /etc/hosts /tmp/hosts &&
|
|
sed -i -e "/^{{ item.1 }}[ \t]*{{ inventory_hostname }}/d" /tmp/hosts &&
|
|
if ! diff -q /tmp/hosts /etc/hosts >/dev/null; then
|
|
cp /tmp/hosts /etc/hosts &&
|
|
echo changed
|
|
fi &&
|
|
rm /tmp/hosts'
|
|
changed_when: "'changed' in sed_result.stdout"
|
|
with_nested:
|
|
- "{{ ps_result.results }}"
|
|
- - "127.0.0.1"
|
|
- "{{ admin_oc_net_name | net_ip }}"
|
|
when: item.0.rc == 0
|
|
register: sed_result
|
|
when: admin_oc_net_name | net_ip != None
|