From 288500cdf1fa04f1311cf4b126c88d190bb6113f Mon Sep 17 00:00:00 2001 From: Jimmy McCrory Date: Mon, 20 Jun 2016 15:06:01 -0700 Subject: [PATCH] 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 --- tasks/swift_key_distribute.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/tasks/swift_key_distribute.yml b/tasks/swift_key_distribute.yml index 8c79a195..46396230 100644 --- a/tasks/swift_key_distribute.yml +++ b/tasks/swift_key_distribute.yml @@ -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