when managing /etc/hosts, remove existing host entries

Bug #1853578 reported by Radosław Piliszek
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
kolla-ansible
In Progress
Medium
Chason Chan

Bug Description

When kolla-ansible is to manage /etc/hosts, it adds its entries but it does not ensure current ones are gone which leads to RabbitMQ issues.

Example /etc/hosts contents after run:

127.0.0.1 localhost
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
172.16.34.10 cloudnode1
172.16.34.11 cloudnode2
172.16.34.12 cloudnode3
172.16.34.240 kolladeploy
# BEGIN ANSIBLE GENERATED HOSTS
172.16.35.10 cloudnode1
172.16.35.11 cloudnode2
172.16.35.12 cloudnode3
# END ANSIBLE GENERATED HOSTS

Tags: hosts rabbitmq
Revision history for this message
Mark Goddard (mgoddard) wrote :

FWIW, it should remove any IPs within the begin/end block.

Revision history for this message
Radosław Piliszek (yoctozepto) wrote :

... which users are unlikely to introduce for themselves.

Revision history for this message
Mark Goddard (mgoddard) wrote :

I just meant that if the IP changes and you run bootstrap-servers again, kolla-ansible should update the existing entry. It won't change anything it didn't introduce.

Changed in kolla-ansible:
status: New → Triaged
Revision history for this message
Chason Chan (chen-xing) wrote :

Should we remove the block of "ANSIBLE GENERATED HOSTS" or "the existing host entries"?

Revision history for this message
Radosław Piliszek (yoctozepto) wrote :

@Chason - the existing host entries

Revision history for this message
Chason Chan (chen-xing) wrote :

OK, will propose a fix. thanks@Radosław

Changed in kolla-ansible:
assignee: nobody → Chason Chan (chen-xing)
Revision history for this message
Mark Goddard (mgoddard) wrote :

Would it always be safe to remove an entry that we did not add?

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to kolla-ansible (master)

Fix proposed to branch: master
Review: https://review.opendev.org/696047

Changed in kolla-ansible:
status: Triaged → In Progress
Revision history for this message
Radosław Piliszek (yoctozepto) wrote :
Revision history for this message
Radosław Piliszek (yoctozepto) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.