[Upgrades] deploy_steps fail with AnsibleUndefinedVariable: \'dict object\' has no attribute \'ansible_hostname\'"

Bug #1782168 reported by Jose Luis Franco
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Fix Released
High
Jose Luis Franco

Bug Description

Major upgrades from Queens to Master/Rocky fail during "overcloud upgrade run" step when having two or more hosts defined under the "overcloud" ansible group:

 u'PLAY [Common roles for TripleO servers] ****************************************',
 u'',
 u'TASK [tripleo-bootstrap : Deploy required packages to bootstrap TripleO] *******',
 u'Wednesday 11 July 2018 19:08:49 +0000 (0:00:00.155) 0:00:05.423 ******** ',
 u'ok: [overcloud-controller-0] => {"changed": false, "msg": "", "rc": 0, "results": ["openstack-heat-agents-1.5.4-0.20180308153305.ecf43c7.el7.centos.noarch providing openstack-heat-agents is already installed", "jq-1.5-10.el7.x86_64 providing jq is already installed"]}',
 u'',
 u'TASK [tripleo-bootstrap : Create /var/lib/heat-config/tripleo-config-download directory for deployment data] ***',
 u'Wednesday 11 July 2018 19:08:50 +0000 (0:00:01.112) 0:00:06.535 ******** ',
 u'ok: [overcloud-controller-0] => {"changed": false, "gid": 0, "group": "root", "mode": "0755", "owner": "root", "path": "/var/lib/heat-config/tripleo-config-download", "secontext": "unconfined_u:object_r:var_lib_t:s0", "size": 6, "state": "directory", "uid": 0}',
 u'',
 u'TASK [tripleo-ssh-known-hosts : Template /etc/ssh/ssh_known_hosts] *************',
 u'Wednesday 11 July 2018 19:08:50 +0000 (0:00:00.569) 0:00:07.105 ******** ',
 u'fatal: [overcloud-controller-0]: FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: \'dict object\' has no attribute \'ansible_hostname\'"}',
 u'',
 u'NO MORE HOSTS LEFT *************************************************************',
 u'',
 u'PLAY RECAP *********************************************************************',
 u'overcloud-controller-0 : ok=4 changed=0 unreachable=0 failed=1 ',
 u'',
 u'Wednesday 11 July 2018 19:08:51 +0000 (0:00:00.328) 0:00:07.434 ******** ',

The cause of this issue is in the fact that the "overcloud upgrade run" is being run with the option --roles Controller. This option limits the playbooks execution to a single role, in this case the "Controller" one. Therefore, when gathering facts in [0], we are gathering only for the Overcloud's controller, leaving any other host defined as children of the group overcloud without facts gathering. Then, deploy_steps_playbook.yaml invokes the role tripleo-ssh-known-hosts, which creates the following template depending on the groups['overcloud'] var [1]. groups['overcloud'] var contains all the hosts in the overcloud (controller, compute, cepth, etc...) but the facts_gathering step was run only for the controller, so when accessing to other hosts ansible facts the task fails.

[0] - https://github.com/openstack/tripleo-heat-templates/blob/master/common/deploy-steps.j2#L405
[1] - https://github.com/openstack/tripleo-common/blob/master/roles/tripleo-ssh-known-hosts/templates/ssh_known_hosts.j2#L1

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

Fix proposed to branch: master
Review: https://review.openstack.org/583280

Changed in tripleo:
assignee: nobody → Jose Luis Franco (jfrancoa)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-common (master)

Fix proposed to branch: master
Review: https://review.openstack.org/584994

Changed in tripleo:
milestone: rocky-3 → rocky-rc1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on tripleo-heat-templates (master)

Change abandoned by Jose Luis Franco (<email address hidden>) on branch: master
Review: https://review.openstack.org/583280
Reason: Abandon for https://review.openstack.org/#/c/584994/

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

Fix proposed to branch: stable/queens
Review: https://review.openstack.org/589150

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

Reviewed: https://review.openstack.org/584994
Committed: https://git.openstack.org/cgit/openstack/tripleo-common/commit/?id=44ed2ea4b8bb0126c5b4a65e7712000d9b9f4655
Submitter: Zuul
Branch: master

commit 44ed2ea4b8bb0126c5b4a65e7712000d9b9f4655
Author: Jose Luis Franco Arza <email address hidden>
Date: Mon Jul 23 20:22:47 2018 +0200

    Set known hosts when --limit is set.

    When the option --limit is specified the tasks will
    run only on those hosts passed in the option (or all
    except the one passed if patterns are used), for that
    reason we can't consider that the facts will be
    available for all hosts inside the 'overcloud' group.

    This patch appends a new line into the known hosts file
    with the available 'overcloud' group hosts instead of
    creating a new ssh_known_hosts file.

    Change-Id: I8c687c53aa4cff18ac15c332a72fb40ed730e69c
    Closes-Bug: #1782168

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

Reviewed: https://review.openstack.org/589150
Committed: https://git.openstack.org/cgit/openstack/tripleo-common/commit/?id=d4257fead2f3a9960daa4cddd156bea72faed7ee
Submitter: Zuul
Branch: stable/queens

commit d4257fead2f3a9960daa4cddd156bea72faed7ee
Author: Jose Luis Franco Arza <email address hidden>
Date: Mon Jul 23 20:22:47 2018 +0200

    Set known hosts when --limit is set.

    When the option --limit is specified the tasks will
    run only on those hosts passed in the option (or all
    except the one passed if patterns are used), for that
    reason we can't consider that the facts will be
    available for all hosts inside the 'overcloud' group.

    This patch appends a new line into the known hosts file
    with the available 'overcloud' group hosts instead of
    creating a new ssh_known_hosts file.

    (cherry picked from commit 44ed2ea4b8bb0126c5b4a65e7712000d9b9f4655)

    Change-Id: I8c687c53aa4cff18ac15c332a72fb40ed730e69c
    Closes-Bug: #1782168

tags: added: in-stable-queens
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-common 9.3.0

This issue was fixed in the openstack/tripleo-common 9.3.0 release.

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

This issue was fixed in the openstack/tripleo-common 8.6.5 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.