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 b71c5bf7ff
commit 4196ab27b5
2 changed files with 4 additions and 4 deletions

View File

@@ -16,7 +16,7 @@
- name: Create authorized keys file from host vars - name: Create authorized keys file from host vars
authorized_key: authorized_key:
user: "{{ nova_system_user_name }}" user: "{{ nova_system_user_name }}"
key: "{{ hostvars[item]['nova_pubkey'] }}" key: "{{ hostvars[item]['nova_pubkey'] | b64decode }}"
with_items: groups['nova_compute'] with_items: groups['nova_compute']
tags: tags:
- nova-key - nova-key

View File

@@ -25,8 +25,8 @@
- nova-key-create - nova-key-create
- name: Get public key contents and store as var - name: Get public key contents and store as var
command: | slurp:
cat {{ nova_system_home_folder }}/.ssh/id_rsa.pub src: "{{ nova_system_home_folder }}/.ssh/id_rsa.pub"
register: nova_pub register: nova_pub
changed_when: false changed_when: false
tags: tags:
@@ -35,7 +35,7 @@
- name: Register a fact for the nova pub key - name: Register a fact for the nova pub key
set_fact: set_fact:
nova_pubkey: "{{ nova_pub.stdout }}" nova_pubkey: "{{ nova_pub.content }}"
tags: tags:
- nova-key - nova-key
- nova-key-create - nova-key-create