From dbd5f9948b456c9f55eb291da24785e33b2723f5 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Wed, 13 Jan 2016 11:20:03 +0000 Subject: [PATCH] Use slurp to collect the keystone ssh keys Extracting the ssh public key using cat and storing the result in a fact has resulted in periodic failures in the collection of the key, and thereafter the failure to appropriately place that key into the authorised_keys file. This patch changes the collection method to use the Ansible slurp module which has been found to be more reliable. Change-Id: Iac61518129536ce613e91ac894883440a8704998 --- tasks/keystone_key_distribute.yml | 2 +- tasks/keystone_key_populate.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tasks/keystone_key_distribute.yml b/tasks/keystone_key_distribute.yml index b41659ad..760e6287 100644 --- a/tasks/keystone_key_distribute.yml +++ b/tasks/keystone_key_distribute.yml @@ -16,7 +16,7 @@ - name: Create authorized keys file from host vars authorized_key: user: "{{ keystone_system_user_name }}" - key: "{{ hostvars[item]['keystone_pubkey'] }}" + key: "{{ hostvars[item]['keystone_pubkey'] | b64decode }}" with_items: groups['keystone_all'] tags: - keystone-key diff --git a/tasks/keystone_key_populate.yml b/tasks/keystone_key_populate.yml index 92b58f93..b61ad53f 100644 --- a/tasks/keystone_key_populate.yml +++ b/tasks/keystone_key_populate.yml @@ -14,8 +14,8 @@ # limitations under the License. - name: Get public key contents and store as var - command: | - cat {{ keystone_system_user_home }}/.ssh/id_rsa.pub + slurp: + src: "{{ keystone_system_user_home }}/.ssh/id_rsa.pub" register: keystone_pub changed_when: false tags: @@ -24,7 +24,7 @@ - name: Register a fact for the keystone pub key set_fact: - keystone_pubkey: "{{ keystone_pub.stdout }}" + keystone_pubkey: "{{ keystone_pub.content }}" tags: - keystone-key - keystone-key-create