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
This commit is contained in:
Jesse Pretorius 2016-01-13 11:07:04 +00:00 committed by Jesse Pretorius (odyssey4me)
parent 8a8ad448fe
commit b4a9dfb10e
2 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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