Undercloud update and install stomps /etc/hosts on the Director node

Bug #1924751 reported by Brendan Shephard
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Fix Released
High
Brendan Shephard

Bug Description

Description of problem:

Overcloud host entries of /etc/hosts on the undercloud were removed after re-executing `openstack undercloud install` like the following.
~~~
(undercloud) [stack@undercloud-0 ~]$ cat /etc/hosts
# BEGIN ANSIBLE MANAGED BLOCK
192.168.24.1 undercloud-0.redhat.local undercloud-0
192.168.24.1 undercloud-0.external.redhat.local undercloud-0.external
192.168.24.1 undercloud-0.ctlplane.redhat.local undercloud-0.ctlplane

# END ANSIBLE MANAGED BLOCK
127.0.0.1 undercloud-0.redhat.local undercloud-0
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
~~~
All the overcloud host entries were deleted.

Version-Release number of selected component (if applicable):
 - python3-tripleoclient-12.3.2-1.20200914164930.el8ost.noarch

How reproducible:

100%

Steps to Reproduce:
1. Execute openstack undercloud install
2. Execute `openstack undercloud install` again

Actual results:

Overcloud host entries of /etc/hosts file on the undercloud node are deleted.

Expected results:

Overcloud host entries of /etc/hosts file on the undercloud node are remaining after executing `openstack undercloud install`.

Additional info:

I added some overcloud host entries and executed `openstack undercloud install` again. And it can be reproduced.
Here's the diff between the /etc/hosts.
~~~
(undercloud) [stack@undercloud-0 ~]$ diff -Npu /etc/hosts hosts.backup-20210225-1300|less
--- /etc/hosts 2021-02-25 04:06:04.187073777 +0000
+++ hosts.backup-20210225-1300 2021-02-25 04:00:44.986120333 +0000
@@ -3,6 +3,29 @@
 192.168.24.1 undercloud-0.external.redhat.local undercloud-0.external
 192.168.24.1 undercloud-0.ctlplane.redhat.local undercloud-0.ctlplane

+172.17.1.78 controller-0.redhat.local controller-0
+172.17.3.135 controller-0.storage.redhat.local controller-0.storage
+172.17.4.126 controller-0.storagemgmt.redhat.local controller-0.storagemgmt
+172.17.1.78 controller-0.internalapi.redhat.local controller-0.internalapi
+172.17.2.25 controller-0.tenant.redhat.local controller-0.tenant
+10.0.0.127 controller-0.external.redhat.local controller-0.external
+192.168.24.34 controller-0.ctlplane.redhat.local controller-0.ctlplane
+172.17.1.18 controller-1.redhat.local controller-1
+172.17.3.25 controller-1.storage.redhat.local controller-1.storage
+172.17.4.103 controller-1.storagemgmt.redhat.local controller-1.storagemgmt
+172.17.1.18 controller-1.internalapi.redhat.local controller-1.internalapi
+172.17.2.67 controller-1.tenant.redhat.local controller-1.tenant
+10.0.0.129 controller-1.external.redhat.local controller-1.external
+192.168.24.14 controller-1.ctlplane.redhat.local controller-1.ctlplane
+172.17.1.68 controller-2.redhat.local controller-2
+172.17.3.81 controller-2.storage.redhat.local controller-2.storage
+172.17.4.76 controller-2.storagemgmt.redhat.local controller-2.storagemgmt
+172.17.1.68 controller-2.internalapi.redhat.local controller-2.internalapi
+172.17.2.47 controller-2.tenant.redhat.local controller-2.tenant
+10.0.0.106 controller-2.external.redhat.local controller-2.external
+192.168.24.11 controller-2.ctlplane.redhat.local controller-2.ctlplane
+
+
 # END ANSIBLE MANAGED BLOCK
 127.0.0.1 undercloud-0.redhat.local undercloud-0
 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4

(undercloud) [stack@undercloud-0 ~]$ cat /etc/hosts
# BEGIN ANSIBLE MANAGED BLOCK
192.168.24.1 undercloud-0.redhat.local undercloud-0
192.168.24.1 undercloud-0.external.redhat.local undercloud-0.external
192.168.24.1 undercloud-0.ctlplane.redhat.local undercloud-0.ctlplane

# END ANSIBLE MANAGED BLOCK
127.0.0.1 undercloud-0.redhat.local undercloud-0
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
~~~

Revision history for this message
Brendan Shephard (bshephar) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-tripleoclient (master)
Changed in tripleo:
status: New → In Progress
Revision history for this message
Brendan Shephard (bshephar) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-ansible (master)
Revision history for this message
Brendan Shephard (bshephar) wrote :
Changed in tripleo:
assignee: nobody → Brendan Shephard (bshephar)
Revision history for this message
Brendan Shephard (bshephar) wrote :

This also impacts DCN deployments. Whichever stack is deployed last will write the hosts entries, so the proposed change will write blocks of hosts entries per stack / plan. Which will mean we're only changing specific blocks during each deployment, leaving the existing ones alone.

Changed in tripleo:
status: In Progress → Triaged
importance: Undecided → High
milestone: none → wallaby-rc1
Changed in tripleo:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-heat-templates (master)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on python-tripleoclient (master)

Change abandoned by "Brendan Shephard <email address hidden>" on branch: master
Review: https://review.opendev.org/c/openstack/python-tripleoclient/+/786621
Reason: This is a problem that will be solved with tripleo-heat-templates and tripleo-ansible instead.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-heat-templates (master)

Reviewed: https://review.opendev.org/c/openstack/tripleo-heat-templates/+/787327
Committed: https://opendev.org/openstack/tripleo-heat-templates/commit/0f1230d0b5535959a53fbe04a0ec31441eae29f8
Submitter: "Zuul (22348)"
Branch: master

commit 0f1230d0b5535959a53fbe04a0ec31441eae29f8
Author: Brendan <email address hidden>
Date: Wed Apr 21 18:39:33 2021 +1000

    Add RootStackName to group_vars

    After a Overcloud deployment, /etc/hosts on the undercloud
    will be populated with entries for each overcloud node. Since
    we use the same tripleo_ansible roles for both the undercloud
    and overcloud deployment, the /etc/hosts file on the Director
    will be removed by undercloud install / upgrade operations.

    This is outlined here:
    https://bugzilla.redhat.com/show_bug.cgi?id=1933528

    This change adds the RootStackName to the group_vars,
    this is then used by the tripleo_host_entries role in
    tripleo-ansible to write host entries per stack.

    Closes-Bug: #1924751
    RHBZ: 1933528
    Change-Id: I9e53187f37d41d7180e66db1239b5f9c8846addd

Changed in tripleo:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-ansible (master)

Reviewed: https://review.opendev.org/c/openstack/tripleo-ansible/+/786623
Committed: https://opendev.org/openstack/tripleo-ansible/commit/9879d3b5db84e25853f4968314a6843f7fd41353
Submitter: "Zuul (22348)"
Branch: master

commit 9879d3b5db84e25853f4968314a6843f7fd41353
Author: Brendan <email address hidden>
Date: Fri Apr 16 20:55:18 2021 +1000

    Write hosts entries per environment

    This change will write /etc/hosts entries per plan
    rather than stomping the hosts entries every time
    the role is used for different stacks / plans.

    We achieve this by differentiating the blocks of IP
    addresses to ensure they are not modified by unrelated
    executions of the role.

    Closes-Bug: #1924751
    RHBZ: 1933528
    Depends-On: I9e53187f37d41d7180e66db1239b5f9c8846addd
    Change-Id: I7396ad4d25fec44000ead88b24e818abc107b5f8

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-ansible (stable/victoria)

Fix proposed to branch: stable/victoria
Review: https://review.opendev.org/c/openstack/tripleo-ansible/+/787612

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-heat-templates (stable/victoria)

Fix proposed to branch: stable/victoria
Review: https://review.opendev.org/c/openstack/tripleo-heat-templates/+/787746

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-heat-templates (stable/ussuri)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-ansible (stable/ussuri)

Fix proposed to branch: stable/ussuri
Review: https://review.opendev.org/c/openstack/tripleo-ansible/+/788088

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-heat-templates (stable/train)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-ansible (stable/train)

Fix proposed to branch: stable/train
Review: https://review.opendev.org/c/openstack/tripleo-ansible/+/788100

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-heat-templates (stable/victoria)

Reviewed: https://review.opendev.org/c/openstack/tripleo-heat-templates/+/787746
Committed: https://opendev.org/openstack/tripleo-heat-templates/commit/50c089a1f6bb125be19d4a80c666ee8089684006
Submitter: "Zuul (22348)"
Branch: stable/victoria

commit 50c089a1f6bb125be19d4a80c666ee8089684006
Author: Brendan <email address hidden>
Date: Wed Apr 21 18:39:33 2021 +1000

    Add RootStackName to group_vars

    After a Overcloud deployment, /etc/hosts on the undercloud
    will be populated with entries for each overcloud node. Since
    we use the same tripleo_ansible roles for both the undercloud
    and overcloud deployment, the /etc/hosts file on the Director
    will be removed by undercloud install / upgrade operations.

    This is outlined here:
    https://bugzilla.redhat.com/show_bug.cgi?id=1933528

    This change adds the RootStackName to the group_vars,
    this is then used by the tripleo_host_entries role in
    tripleo-ansible to write host entries per stack.

    Closes-Bug: #1924751
    Resolves: rhbz#1933528
    Change-Id: I9e53187f37d41d7180e66db1239b5f9c8846addd

tags: added: in-stable-victoria
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-heat-templates (stable/ussuri)

Reviewed: https://review.opendev.org/c/openstack/tripleo-heat-templates/+/787954
Committed: https://opendev.org/openstack/tripleo-heat-templates/commit/35b9949dd470bde5c869a2e097d2da2fc02c6a7c
Submitter: "Zuul (22348)"
Branch: stable/ussuri

commit 35b9949dd470bde5c869a2e097d2da2fc02c6a7c
Author: Brendan <email address hidden>
Date: Wed Apr 21 18:39:33 2021 +1000

    Add RootStackName to group_vars

    After a Overcloud deployment, /etc/hosts on the undercloud
    will be populated with entries for each overcloud node. Since
    we use the same tripleo_ansible roles for both the undercloud
    and overcloud deployment, the /etc/hosts file on the Director
    will be removed by undercloud install / upgrade operations.

    This is outlined here:
    https://bugzilla.redhat.com/show_bug.cgi?id=1933528

    This change adds the RootStackName to the group_vars,
    this is then used by the tripleo_host_entries role in
    tripleo-ansible to write host entries per stack.

    Closes-Bug: #1924751
    Resolves: rhbz#1933528
    Change-Id: I9e53187f37d41d7180e66db1239b5f9c8846addd

tags: added: in-stable-ussuri
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-heat-templates (stable/train)

Reviewed: https://review.opendev.org/c/openstack/tripleo-heat-templates/+/788093
Committed: https://opendev.org/openstack/tripleo-heat-templates/commit/002445bea96e78897488082f6e0435581f1ddbf9
Submitter: "Zuul (22348)"
Branch: stable/train

commit 002445bea96e78897488082f6e0435581f1ddbf9
Author: Brendan <email address hidden>
Date: Wed Apr 21 18:39:33 2021 +1000

    Add RootStackName to group_vars

    After a Overcloud deployment, /etc/hosts on the undercloud
    will be populated with entries for each overcloud node. Since
    we use the same tripleo_ansible roles for both the undercloud
    and overcloud deployment, the /etc/hosts file on the Director
    will be removed by undercloud install / upgrade operations.

    This is outlined here:
    https://bugzilla.redhat.com/show_bug.cgi?id=1933528

    This change adds the RootStackName to the group_vars,
    this is then used by the tripleo_host_entries role in
    tripleo-ansible to write host entries per stack.

    Closes-Bug: #1924751
    Resolves: rhbz#1933528
    Change-Id: I9e53187f37d41d7180e66db1239b5f9c8846addd

tags: added: in-stable-train
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-ansible (stable/victoria)

Reviewed: https://review.opendev.org/c/openstack/tripleo-ansible/+/787612
Committed: https://opendev.org/openstack/tripleo-ansible/commit/a56465a5e1e324321ea5c514cf115b5dab647895
Submitter: "Zuul (22348)"
Branch: stable/victoria

commit a56465a5e1e324321ea5c514cf115b5dab647895
Author: Brendan <email address hidden>
Date: Fri Apr 16 20:55:18 2021 +1000

    Write hosts entries per environment

    This change will write /etc/hosts entries per plan
    rather than stomping the hosts entries every time
    the role is used for different stacks / plans.

    We achieve this by differentiating the blocks of IP
    addresses to ensure they are not modified by unrelated
    executions of the role.

    Closes-Bug: #1924751
    Resolves: rhbz#1933528
    Depends-On: I9e53187f37d41d7180e66db1239b5f9c8846addd
    Change-Id: I7396ad4d25fec44000ead88b24e818abc107b5f8

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-ansible (stable/train)

Reviewed: https://review.opendev.org/c/openstack/tripleo-ansible/+/788100
Committed: https://opendev.org/openstack/tripleo-ansible/commit/4940f3fff036a430ab9ac65f583df2d30ecedb94
Submitter: "Zuul (22348)"
Branch: stable/train

commit 4940f3fff036a430ab9ac65f583df2d30ecedb94
Author: Brendan <email address hidden>
Date: Fri Apr 16 20:55:18 2021 +1000

    Write hosts entries per environment

    This change will write /etc/hosts entries per plan
    rather than stomping the hosts entries every time
    the role is used for different stacks / plans.

    We achieve this by differentiating the blocks of IP
    addresses to ensure they are not modified by unrelated
    executions of the role.

    Closes-Bug: #1924751
    Resolves: rhbz#1933528
    Depends-On: I9e53187f37d41d7180e66db1239b5f9c8846addd
    Change-Id: I7396ad4d25fec44000ead88b24e818abc107b5f8

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-ansible (stable/ussuri)

Reviewed: https://review.opendev.org/c/openstack/tripleo-ansible/+/788088
Committed: https://opendev.org/openstack/tripleo-ansible/commit/aa5f45585a65f3164f9f51a66aa13a07c8772c68
Submitter: "Zuul (22348)"
Branch: stable/ussuri

commit aa5f45585a65f3164f9f51a66aa13a07c8772c68
Author: Brendan <email address hidden>
Date: Fri Apr 16 20:55:18 2021 +1000

    Write hosts entries per environment

    This change will write /etc/hosts entries per plan
    rather than stomping the hosts entries every time
    the role is used for different stacks / plans.

    We achieve this by differentiating the blocks of IP
    addresses to ensure they are not modified by unrelated
    executions of the role.

    Closes-Bug: #1924751
    Resolves: rhbz#1933528
    Depends-On: I9e53187f37d41d7180e66db1239b5f9c8846addd
    Change-Id: I7396ad4d25fec44000ead88b24e818abc107b5f8

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-ansible 3.1.0

This issue was fixed in the openstack/tripleo-ansible 3.1.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-heat-templates 14.1.0

This issue was fixed in the openstack/tripleo-heat-templates 14.1.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-ansible 2.3.0

This issue was fixed in the openstack/tripleo-ansible 2.3.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-heat-templates 13.3.0

This issue was fixed in the openstack/tripleo-heat-templates 13.3.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-ansible 0.8.0

This issue was fixed in the openstack/tripleo-ansible 0.8.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-heat-templates 11.6.0

This issue was fixed in the openstack/tripleo-heat-templates 11.6.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-ansible 1.5.4

This issue was fixed in the openstack/tripleo-ansible 1.5.4 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-heat-templates 12.4.4

This issue was fixed in the openstack/tripleo-heat-templates 12.4.4 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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