From b4a9dfb10e044429fd0d4e78af56206de52ebe4a Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Wed, 13 Jan 2016 11:07:04 +0000 Subject: [PATCH] Use slurp to collect the nova 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. Closes-Bug: #1531783 Change-Id: I26340a0c69064f84d9d87f19ce015ba44b6ffa8b --- tasks/nova_compute_key_distribute.yml | 2 +- tasks/nova_compute_key_populate.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tasks/nova_compute_key_distribute.yml b/tasks/nova_compute_key_distribute.yml index f93cd2f6..7dfc8d43 100644 --- a/tasks/nova_compute_key_distribute.yml +++ b/tasks/nova_compute_key_distribute.yml @@ -16,7 +16,7 @@ - name: Create authorized keys file from host vars authorized_key: user: "{{ nova_system_user_name }}" - key: "{{ hostvars[item]['nova_pubkey'] }}" + key: "{{ hostvars[item]['nova_pubkey'] | b64decode }}" with_items: groups['nova_compute'] tags: - nova-key diff --git a/tasks/nova_compute_key_populate.yml b/tasks/nova_compute_key_populate.yml index 30849291..1a2fb80d 100644 --- a/tasks/nova_compute_key_populate.yml +++ b/tasks/nova_compute_key_populate.yml @@ -25,8 +25,8 @@ - nova-key-create - name: Get public key contents and store as var - command: | - cat {{ nova_system_home_folder }}/.ssh/id_rsa.pub + slurp: + src: "{{ nova_system_home_folder }}/.ssh/id_rsa.pub" register: nova_pub changed_when: false tags: @@ -35,7 +35,7 @@ - name: Register a fact for the nova pub key set_fact: - nova_pubkey: "{{ nova_pub.stdout }}" + nova_pubkey: "{{ nova_pub.content }}" tags: - nova-key - nova-key-create