tests: test.yml: Use the 'slurp' module to get the SSH key

The lookup() module no longer works with Ansible 2.4 for fetching the
root's SSH key as it fails with the following error:

fatal: [localhost]: FAILED! => {
    "msg": "An unhandled exception occurred while running the lookup
plugin 'file'. Error was a <class 'ansible.errors.AnsibleError'>,
original message: could not locate file in lookup: ~/.ssh/id_rsa.pub"
}

Lets use the 'slurp' module which should work as expected.

Change-Id: If2127c8d4aacb37344f5c2435264aaa0669da618
This commit is contained in:
Markos Chandras 2018-01-15 14:55:16 +00:00
parent 665bca7d3e
commit 8a1845c7af

View File

@ -35,9 +35,14 @@
ssh_key_bits: 2048
ssh_key_file: ".ssh/id_rsa"
- name: Get root ssh key
slurp:
src: '~/.ssh/id_rsa.pub'
register: _root_ssh_key
- name: Prepare container ssh key fact
set_fact:
lxc_container_ssh_key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
lxc_container_ssh_key: "{{ _root_ssh_key['content'] | b64decode }}"
# This is a very dirty hack due to images.linuxcontainers.org
# constantly failing to resolve in openstack-infra.