From 8a1845c7afd0d9d3a2e0a783953fee85734a9f02 Mon Sep 17 00:00:00 2001 From: Markos Chandras Date: Mon, 15 Jan 2018 14:55:16 +0000 Subject: [PATCH] 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 , 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 --- tests/test.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/test.yml b/tests/test.yml index e34ecd82..af65fdd3 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -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.