kolla-ansible bootstrap-servers fails when api_interface is invalid

Bug #1665364 reported by Mark Goddard on 2017-02-16
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
kolla-ansible
Medium
Mark Goddard

Bug Description

When bootstrapping a host for kolla-ansible the 'kolla-ansible bootstrap-servers' command can fail if for any of the hosts the 'api_interface' is invalid. This could be true for a number of reasons:

- The 'api_interface' variable is undefined.
- The host does not have a network interface matching 'api_interface'.

Valid causes for the second point include:
- The Ansible control host (localhost) is in the inventory but is not intended to be a target host.
- One of the hosts (currently must be localhost) is a Bifrost host, which does not need a valid api_interface.
- The services mapped to the host do not require the use of an api_interface.

Steps to reproduce:

Install kolla-ansible
Configure /etc/kolla/globals.yml setting api_interface to an invalid value or empty.
In the Ansible inventory file, ensure that all required hosts are in the baremetal group.
Run 'kolla-ansible bootstrap-servers'

Expected results:
Kolla-ansible bootstraps all hosts in the baremetal group.

Actual results:
The command fails with the following output:

[vagrant@localhost ~]$ kolla-ansible bootstrap-servers
Bootstraping servers : ansible-playbook -i /usr/share/kolla-ansible/ansible/inventory/all-in-one -e @/etc/kolla/globals.yml -e @/etc/kolla/passwords.yml -e CONFIG_DIR=/etc/kolla -e action=bootstrap-servers /usr/share/kolla-ansible/ansible/kolla-host.yml

PLAY [Apply role baremetal] ****************************************************

TASK [baremetal : include] *****************************************************
included: /usr/share/kolla-ansible/ansible/roles/baremetal/tasks/bootstrap-servers.yml for localhost

TASK [baremetal : include] *****************************************************
included: /usr/share/kolla-ansible/ansible/roles/baremetal/tasks/pre-install.yml for localhost

TASK [baremetal : Install python2 and python-simplejson] ***********************
changed: [localhost]

TASK [baremetal : Gather facts] ************************************************
ok: [localhost]

TASK [baremetal : Ensure localhost in /etc/hosts] ******************************
ok: [localhost]

TASK [baremetal : Generate /etc/hosts for all of the nodes] ********************
fatal: [localhost]: FAILED! => {"failed": true, "msg": "Unexpected templating type error occurred on ({% for host in groups['all'] %}\n{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }} {{ hostvars[host]['ansible_hostname'] }}\n{% endfor %}\n): cannot concatenate 'str' and 'NoneType' objects"}
 [WARNING]: Could not create retry file '/usr/share/kolla-ansible/ansible/kolla-host.retry'. [Errno 13] Permission denied: u'/usr/share/kolla-ansible/ansible/kolla-host.retry'

PLAY RECAP *********************************************************************
localhost : ok=5 changed=1 unreachable=0 failed=1

Command failed ansible-playbook -i /usr/share/kolla-ansible/ansible/inventory/all-in-one -e @/etc/kolla/globals.yml -e @/etc/kolla/passwords.yml -e CONFIG_DIR=/etc/kolla -e action=bootstrap-servers /usr/share/kolla-ansible/ansible/kolla-host.yml

Mark Goddard (mgoddard) on 2017-02-16
Changed in kolla-ansible:
assignee: nobody → Mark Goddard (mgoddard)
status: New → In Progress
Changed in kolla-ansible:
importance: Undecided → Medium
milestone: none → pike-2
Changed in kolla-ansible:
milestone: pike-2 → pike-3

Reviewed: https://review.openstack.org/434940
Committed: https://git.openstack.org/cgit/openstack/kolla-ansible/commit/?id=64b09d6eb0734249843bfc4f8fc8058222bf3804
Submitter: Jenkins
Branch: master

commit 64b09d6eb0734249843bfc4f8fc8058222bf3804
Author: Mark Goddard <email address hidden>
Date: Thu Feb 16 14:29:24 2017 +0000

    Fix bootstrap-servers with invalid api_interface

    When bootstrapping a host for kolla-ansible the 'kolla-ansible
    bootstrap-servers' command can fail if for any of the hosts the
    'api_interface' is invalid. This happen if the host does not have a
    network interface matching 'api_interface'. This is possible on
    a host running bifrost, as bifrost does not require the api_interface
    variable to be set.

    This change avoids adding a hosts entry for hosts in the bifrost group
    that do not have a valid api_interface. It also avoids modifying the
    hosts file on hosts in the bifrost group that do not have a valid
    api_interface.

    Change-Id: Ie111ef54130adf2556ce83c402cdbb5058ace4f6
    Closes-bug: #1665364

Changed in kolla-ansible:
status: In Progress → Fix Released

This issue was fixed in the openstack/kolla-ansible 5.0.0.0b3 development milestone.

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

Duplicates of this bug

Other bug subscribers