From b93b84c59c7be1da7f0e1e0e397828a83db0d051 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Wed, 11 May 2016 13:33:30 +0100 Subject: [PATCH] Correct LXC host public key check In I167446eee35e40cde645873fbab7491f840dcd15 a pre-flight check was introduced to validate whether an ssh public key is available before doing anything on the LXC hosts. The check is supposed to validate that the requirements for the lookup are available. The lookup is executed on the deployment host, not the target host. The check was therefore incorrect. This patch corrects it to ensure that it does the check in the right places. Change-Id: Ifb5b23e2b472bf0c738a01acefba578754f20b4f --- .../notes/ssh-pub-key-check-c42309653dbe3493.yaml | 5 +++++ tasks/main.yml | 9 +++++---- 2 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/ssh-pub-key-check-c42309653dbe3493.yaml diff --git a/releasenotes/notes/ssh-pub-key-check-c42309653dbe3493.yaml b/releasenotes/notes/ssh-pub-key-check-c42309653dbe3493.yaml new file mode 100644 index 00000000..6b38bb0c --- /dev/null +++ b/releasenotes/notes/ssh-pub-key-check-c42309653dbe3493.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - The check to validate whether an appropriate ssh public key + is available to copy into the container cache has been + corrected to check the deployment host, not the LXC host. diff --git a/tasks/main.yml b/tasks/main.yml index 6503f4a3..e26478da 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -13,17 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Check for the presence of a public key file on the host - stat: +- name: Check for the presence of a public key file on the deployment host + local_action: + module: stat path: /root/.ssh/id_rsa.pub register: _ssh_key when: lxc_container_ssh_key is undefined tags: - always -- name: Fail if a ssh public key is not set in a var and not present on the host +- name: Fail if a ssh public key is not set in a var and is not present on the deployment host fail: - msg: "Please set the lxc_container_ssh_key variable or ensure that the host has the file /root/.ssh/id_rsa.pub present." + msg: "Please set the lxc_container_ssh_key variable or ensure that the deployment host has the file /root/.ssh/id_rsa.pub present." when: - lxc_container_ssh_key is undefined - not _ssh_key.stat.exists