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
This commit is contained in:
Jimmy McCrory 2016-05-24 13:12:02 -07:00
parent b3c05fa39d
commit 8600a80930

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