Skip unavailable hosts when distributing keys

The 'Create authorized keys file from host vars' task assumes that every
host within the swift_all and swift_remote_all groups is available. If
any host within those groups 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 swift_pubkey
hostvar so that the task and remainder of the role can continue when a
swift host is unavailable.

Change-Id: Iee8d5557ae5965d75fd433009796c26324f5dc80
This commit is contained in:
Jimmy McCrory 2016-06-20 15:06:01 -07:00
parent 5a39413607
commit 288500cdf1

View File

@ -18,6 +18,7 @@
user: "{{ swift_system_user_name }}"
key: "{{ hostvars[item]['swift_pubkey'] | b64decode }}"
with_items: groups['swift_all'] + groups['swift_remote_all']
when: hostvars[item]['swift_pubkey'] is defined
tags:
- swift-key
- swift-key-create