Antelope+ overcloud host configured mishandle /etc/hosts when limiting a run to specific hosts

Bug #2051714 reported by Matt Crees
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
kayobe
Status tracked in Caracal
Antelope
Fix Committed
Critical
Matt Crees
Bobcat
Fix Committed
Critical
Matt Crees
Caracal
Fix Released
Critical
Matt Crees
Zed
Invalid
Critical
Matt Crees
kolla-ansible
New
Undecided
Unassigned
Zed
New
Undecided
Unassigned

Bug Description

Running an overcloud host configure limited to some hosts will remove the others from /etc/hosts.

kayobe overcloud host configure --check --diff --limit con1

TASK [etc-hosts : Generate /etc/hosts for all of the nodes] ********************
Tuesday 30 January 2024 15:30:45 +0000 (0:00:00.214) 0:01:18.792 *******
--- before: /etc/hosts (content)
+++ after: /etc/hosts (content)
@@ -2,16 +2,6 @@
 127.0.0.1 localhost
 # BEGIN ANSIBLE GENERATED HOSTS
 10.1.2.1 con1
-10.1.2.2 con2
-10.1.2.3 con3
-10.1.2.4 com1
-10.1.2.4 com2
-10.1.2.6 com3
 # END ANSIBLE GENERATED HOSTS

This is because the variable ``ansible_play_hosts_all`` is used to determine which hosts are templated: https://github.com/openstack/kayobe/blob/0e1532e66dea2f59693796598cc7548e60d44f25/ansible/roles/etc-hosts/defaults/main.yml#L6

Matt Crees (mattcrees)
description: updated
Will Szumski (willjs)
Changed in kayobe:
importance: Undecided → High
status: New → Triaged
importance: High → Critical
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to kayobe (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/kayobe/+/907306

Changed in kayobe:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to kayobe (stable/2023.2)

Fix proposed to branch: stable/2023.2
Review: https://review.opendev.org/c/openstack/kayobe/+/908262

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to kayobe (stable/2023.1)

Fix proposed to branch: stable/2023.1
Review: https://review.opendev.org/c/openstack/kayobe/+/908263

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on kayobe (stable/2023.2)

Change abandoned by "Matt Crees <email address hidden>" on branch: stable/2023.2
Review: https://review.opendev.org/c/openstack/kayobe/+/908262
Reason: cherry-picked too early - wait for master to merge

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on kayobe (stable/2023.1)

Change abandoned by "Matt Crees <email address hidden>" on branch: stable/2023.1
Review: https://review.opendev.org/c/openstack/kayobe/+/908263
Reason: cherry-picked too early - wait for master to merge

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

Reviewed: https://review.opendev.org/c/openstack/kayobe/+/907306
Committed: https://opendev.org/openstack/kayobe/commit/498de81efe88707e5fd91dba24cdee2a529dedbc
Submitter: "Zuul (22348)"
Branch: master

commit 498de81efe88707e5fd91dba24cdee2a529dedbc
Author: Matt Crees <email address hidden>
Date: Wed Jan 31 10:36:19 2024 +0000

    Fix: configure etc-hosts for overcloud group

    Change the etc-hosts role to run on the overcloud group, as using
    ``ansible_play_hosts_all`` would exclude hosts when running with a
    limit.

    Also change the gather-facts-delegated role to run on the overcloud
    group. The delegated task needs to be included separately as the hostvar
    ``ansible_host`` cannot be set dynamically based on a loop item in one
    task. We loop over the batch indices here so that the tasks are included
    in parallel, rather than in series.

    Closes-Bug: #2051714

    Change-Id: I0465eafa9e4ff37c96064ea8395f0bd461035b40

Changed in kayobe:
status: In Progress → Fix Released
Revision history for this message
Matt Crees (mattcrees) wrote :

Doesn't affect Zed, etc-hosts role only present in 2023.1 onwards.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to kayobe (stable/2023.2)

Reviewed: https://review.opendev.org/c/openstack/kayobe/+/908262
Committed: https://opendev.org/openstack/kayobe/commit/1bcf3e19e202e4409f94eff257e5e190bbb26d19
Submitter: "Zuul (22348)"
Branch: stable/2023.2

commit 1bcf3e19e202e4409f94eff257e5e190bbb26d19
Author: Matt Crees <email address hidden>
Date: Wed Jan 31 10:36:19 2024 +0000

    Fix: configure etc-hosts for overcloud group

    Change the etc-hosts role to run on the overcloud group, as using
    ``ansible_play_hosts_all`` would exclude hosts when running with a
    limit.

    Also change the gather-facts-delegated role to run on the overcloud
    group. The delegated task needs to be included separately as the hostvar
    ``ansible_host`` cannot be set dynamically based on a loop item in one
    task. We loop over the batch indices here so that the tasks are included
    in parallel, rather than in series.

    Closes-Bug: #2051714

    Change-Id: I0465eafa9e4ff37c96064ea8395f0bd461035b40
    (cherry picked from commit 498de81efe88707e5fd91dba24cdee2a529dedbc)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to kayobe (stable/2023.1)

Reviewed: https://review.opendev.org/c/openstack/kayobe/+/908263
Committed: https://opendev.org/openstack/kayobe/commit/d7d779533e62ebee40843976c2cd7d8f169bb039
Submitter: "Zuul (22348)"
Branch: stable/2023.1

commit d7d779533e62ebee40843976c2cd7d8f169bb039
Author: Matt Crees <email address hidden>
Date: Wed Jan 31 10:36:19 2024 +0000

    Fix: configure etc-hosts for overcloud group

    Change the etc-hosts role to run on the overcloud group, as using
    ``ansible_play_hosts_all`` would exclude hosts when running with a
    limit.

    Also change the gather-facts-delegated role to run on the overcloud
    group. The delegated task needs to be included separately as the hostvar
    ``ansible_host`` cannot be set dynamically based on a loop item in one
    task. We loop over the batch indices here so that the tasks are included
    in parallel, rather than in series.

    Closes-Bug: #2051714

    Change-Id: I0465eafa9e4ff37c96064ea8395f0bd461035b40
    (cherry picked from commit 498de81efe88707e5fd91dba24cdee2a529dedbc)

Revision history for this message
Maksim Malchuk (mmalchuk) wrote :

IMHO Zed is affected in Kolla-Ansible and should be fixed in the baremetal role. Need check.

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.