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
This commit is contained in:
Jesse Pretorius 2016-01-13 11:20:03 +00:00 committed by Jesse Pretorius (odyssey4me)
parent d84043f941
commit dbd5f9948b
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: "{{ keystone_system_user_name }}" user: "{{ keystone_system_user_name }}"
key: "{{ hostvars[item]['keystone_pubkey'] }}" key: "{{ hostvars[item]['keystone_pubkey'] | b64decode }}"
with_items: groups['keystone_all'] with_items: groups['keystone_all']
tags: tags:
- keystone-key - keystone-key

View File

@ -14,8 +14,8 @@
# limitations under the License. # limitations under the License.
- name: Get public key contents and store as var - name: Get public key contents and store as var
command: | slurp:
cat {{ keystone_system_user_home }}/.ssh/id_rsa.pub src: "{{ keystone_system_user_home }}/.ssh/id_rsa.pub"
register: keystone_pub register: keystone_pub
changed_when: false changed_when: false
tags: tags:
@ -24,7 +24,7 @@
- name: Register a fact for the keystone pub key - name: Register a fact for the keystone pub key
set_fact: set_fact:
keystone_pubkey: "{{ keystone_pub.stdout }}" keystone_pubkey: "{{ keystone_pub.content }}"
tags: tags:
- keystone-key - keystone-key
- keystone-key-create - keystone-key-create