ceph-ansible inventory generation references undefined variable: 'dict object' has no attribute 'ansible_hostname'

Bug #1797117 reported by John Fulton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Fix Released
High
John Fulton

Bug Description

Scaling out a splitstack environment with blacklisted nodes fails while running External deployment step 1:

[root@undercloud-0 stack]# tail -30 /var/lib/mistral/overcloud/ansible.log
2018-10-03 15:07:29,090 p=23844 u=mistral | skipping: [controller-1] => {"changed": false, "skip_reason": "Conditional result was False"}
2018-10-03 15:07:29,122 p=23844 u=mistral | skipping: [controller-0] => {"changed": false, "skip_reason": "Conditional result was False"}
2018-10-03 15:07:29,217 p=23844 u=mistral | skipping: [ceph-1] => {"changed": false, "skip_reason": "Conditional result was False"}
2018-10-03 15:07:29,263 p=23844 u=mistral | skipping: [ceph-0] => {"changed": false, "skip_reason": "Conditional result was False"}
2018-10-03 15:07:29,282 p=23844 u=mistral | skipping: [ceph-2] => {"changed": false, "skip_reason": "Conditional result was False"}
2018-10-03 15:07:36,258 p=23844 u=mistral | changed: [compute-2] => {"changed": true, "cmd": ["ntpdate", "-u", "clock.redhat.com"], "delta": "0:00:06.882513", "end": "2018-10-03 15:07:36.235121", "rc": 0, "start": "2018-10-03 15:07:29.352608", "stderr": "", "stderr_lines": [], "stdout": " 3 Oct 15:07:36 ntpdate[17583]: adjust time server 10.11.160.238 offset -0.003281 sec", "stdout_lines": [" 3 Oct 15:07:36 ntpdate[17583]: adjust time server 10.11.160.238 offset -0.003281 sec"]}
2018-10-03 15:07:36,269 p=23844 u=mistral | PLAY [External deployment step 1] **********************************************
2018-10-03 15:07:36,294 p=23844 u=mistral | TASK [set blacklisted_hostnames] ***********************************************
2018-10-03 15:07:36,294 p=23844 u=mistral | Wednesday 03 October 2018 15:07:36 -0400 (0:00:07.326) 0:11:31.487 *****
2018-10-03 15:07:36,346 p=23844 u=mistral | ok: [undercloud] => {"ansible_facts": {"blacklisted_hostnames": ["compute-0", "compute-1"]}, "changed": false}
2018-10-03 15:07:36,367 p=23844 u=mistral | TASK [create ceph-ansible temp dirs] *******************************************
2018-10-03 15:07:36,368 p=23844 u=mistral | Wednesday 03 October 2018 15:07:36 -0400 (0:00:00.073) 0:11:31.560 *****
2018-10-03 15:07:36,582 p=23844 u=mistral | ok: [undercloud] => (item=/var/lib/mistral/overcloud/ceph-ansible/group_vars) => {"changed": false, "gid": 42430, "group": "mistral", "item": "/var/lib/mistral/overcloud/ceph-ansible/group_vars", "mode": "0755", "owner": "mistral", "path": "/var/lib/mistral/overcloud/ceph-ansible/group_vars", "size": 88, "state": "directory", "uid": 42430}
2018-10-03 15:07:36,758 p=23844 u=mistral | ok: [undercloud] => (item=/var/lib/mistral/overcloud/ceph-ansible/host_vars) => {"changed": false, "gid": 42430, "group": "mistral", "item": "/var/lib/mistral/overcloud/ceph-ansible/host_vars", "mode": "0755", "owner": "mistral", "path": "/var/lib/mistral/overcloud/ceph-ansible/host_vars", "size": 174, "state": "directory", "uid": 42430}
2018-10-03 15:07:36,924 p=23844 u=mistral | ok: [undercloud] => (item=/var/lib/mistral/overcloud/ceph-ansible/fetch_dir) => {"changed": false, "gid": 42430, "group": "mistral", "item": "/var/lib/mistral/overcloud/ceph-ansible/fetch_dir", "mode": "0755", "owner": "mistral", "path": "/var/lib/mistral/overcloud/ceph-ansible/fetch_dir", "size": 80, "state": "directory", "uid": 42430}
2018-10-03 15:07:36,944 p=23844 u=mistral | TASK [generate inventory] ******************************************************
2018-10-03 15:07:36,944 p=23844 u=mistral | Wednesday 03 October 2018 15:07:36 -0400 (0:00:00.576) 0:11:32.136 *****
2018-10-03 15:07:38,740 p=23844 u=mistral | fatal: [undercloud]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'ansible_hostname'\n\nThe error appears to have been in '/var/lib/mistral/overcloud/external_deploy_steps_tasks.yaml': line 15, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n - '{{playbook_dir}}/ceph-ansible/fetch_dir'\n - copy:\n ^ here\n"}
2018-10-03 15:07:38,740 p=23844 u=mistral | NO MORE HOSTS LEFT *************************************************************
2018-10-03 15:07:38,741 p=23844 u=mistral | PLAY RECAP *********************************************************************
2018-10-03 15:07:38,741 p=23844 u=mistral | ceph-0 : ok=124 changed=29 unreachable=0 failed=0
2018-10-03 15:07:38,742 p=23844 u=mistral | ceph-1 : ok=124 changed=29 unreachable=0 failed=0
2018-10-03 15:07:38,742 p=23844 u=mistral | ceph-2 : ok=124 changed=29 unreachable=0 failed=0
2018-10-03 15:07:38,742 p=23844 u=mistral | compute-2 : ok=136 changed=59 unreachable=0 failed=0
2018-10-03 15:07:38,742 p=23844 u=mistral | controller-0 : ok=190 changed=33 unreachable=0 failed=0
2018-10-03 15:07:38,742 p=23844 u=mistral | controller-1 : ok=190 changed=33 unreachable=0 failed=0
2018-10-03 15:07:38,742 p=23844 u=mistral | controller-2 : ok=190 changed=33 unreachable=0 failed=0
2018-10-03 15:07:38,743 p=23844 u=mistral | undercloud : ok=4 changed=0 unreachable=0 failed=1
2018-10-03 15:07:38,743 p=23844 u=mistral | Wednesday 03 October 2018 15:07:38 -0400 (0:00:01.798) 0:11:33.935 *****
2018-10-03 15:07:38,743 p=23844 u=mistral | ===============================================================================

Steps to Reproduce:
1. Deploy splitstack environment with 3 controller + 2 computes + 3 ceph nodes

2. create blacklist.yaml:
parameter_defaults:
  DeploymentServerBlacklist:
    - compute-0
    - compute-1

3. Set ComputeDeployedServerCount: 3

4. Run overcloud deploy command with blacklist.yaml:

openstack overcloud deploy \
--timeout 100 \
--templates /usr/share/openstack-tripleo-heat-templates \
--libvirt-type kvm \
--overcloud-ssh-user stack \
--disable-validation \
-r /home/stack/composable_roles/roles/roles_data.yaml \
-e /usr/share/openstack-tripleo-heat-templates/environments/deployed-server-environment.yaml \
-e /usr/share/openstack-tripleo-heat-templates/environments/deployed-server-bootstrap-environment-rhel.yaml \
-e /usr/share/openstack-tripleo-heat-templates/environments/deployed-server-pacemaker-environment.yaml \
-e /home/stack/composable_roles/network-config.yaml \
-e /home/stack/composable_roles/ctrlplane-template.yml \
-e /home/stack/composable_roles/internal.yaml \
-e /usr/share/openstack-tripleo-heat-templates/environments/network-isolation.yaml \
-e /home/stack/composable_roles/roles-port-config.yml \
-e /home/stack/composable_roles/network/network-environment.yaml \
-e /home/stack/composable_roles/enable-tls.yaml \
-e /home/stack/composable_roles/inject-trust-anchor.yaml \
-e /home/stack/composable_roles/public_vip.yaml \
-e /usr/share/openstack-tripleo-heat-templates/environments/ssl/tls-endpoints-public-ip.yaml \
-e /usr/share/openstack-tripleo-heat-templates/environments/ceph-ansible/ceph-ansible.yaml \
-e /home/stack/composable_roles/debug.yaml \
-e /home/stack/blacklist.yaml \
-e /home/stack/composable_roles/docker-images.yaml \
--log-file overcloud_deployment_64.log

Revision history for this message
John Fulton (jfulton-org) wrote :

Looks like this embedded ansible in tripleo heat templates:

https://github.com/openstack/tripleo-heat-templates/blob/stable/rocky/docker/services/ceph-ansible/ceph-base.yaml#L379-L399

needs to not access hostvars.raw_get(host)['ansible_hostname'] unless that variable is set.

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/609401

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

Fix proposed to branch: stable/rocky
Review: https://review.openstack.org/609682

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

Reviewed: https://review.openstack.org/609401
Committed: https://git.openstack.org/cgit/openstack/tripleo-heat-templates/commit/?id=d556fd68d88f8b34bb1f42013f86247035ea3ea3
Submitter: Zuul
Branch: master

commit d556fd68d88f8b34bb1f42013f86247035ea3ea3
Author: John Fulton <email address hidden>
Date: Wed Oct 10 15:12:26 2018 +0200

    Do not reference ansible_hostname if it is undefined

    Change-Id: I59c3de74c41b97ed1803d82c69db52199f27393e
    Closes-Bug: #1797117

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

Reviewed: https://review.openstack.org/609682
Committed: https://git.openstack.org/cgit/openstack/tripleo-heat-templates/commit/?id=d55940c00e23d44785e030ec8eaa082b16a7ae3a
Submitter: Zuul
Branch: stable/rocky

commit d55940c00e23d44785e030ec8eaa082b16a7ae3a
Author: John Fulton <email address hidden>
Date: Wed Oct 10 15:12:26 2018 +0200

    Do not reference ansible_hostname if it is undefined

    Change-Id: I59c3de74c41b97ed1803d82c69db52199f27393e
    Closes-Bug: #1797117

tags: added: in-stable-rocky
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-heat-templates 10.1.0

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

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

This issue was fixed in the openstack/tripleo-heat-templates 9.1.0 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.