Skip unavailable hosts when distributing keys

The 'Create authorized keys file from host vars' task assumes that every
host within the nova_compute group is available. If any host within that
group is offline, excluded through a limit, or has otherwise failed an
earlier task, it will lead to this task failing for every host.

Add a when clause checking for the existence of the nova_pubkey hostvar
so that the task and remainder of the role can continue when a
nova_compute host is unavailable.

Related-Bug: 1531783
Change-Id: Idec01d13c35632204a2ae0f0a848a0ccc5b34d73
(cherry picked from commit eead8cdb6f78cc50678b53019a5e80f172a54784)
This commit is contained in:
Jimmy McCrory 2016-05-24 13:12:02 -07:00
parent 8fcdb4cc56
commit 7e8b5e73a3
1 changed files with 1 additions and 0 deletions

View File

@ -18,6 +18,7 @@
user: "{{ nova_system_user_name }}"
key: "{{ hostvars[item]['nova_pubkey'] | b64decode }}"
with_items: groups['nova_compute']
when: hostvars[item]['nova_pubkey'] is defined
tags:
- nova-key
- nova-key-distribute