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
This commit is contained in:
Jesse Pretorius 2016-05-11 13:33:30 +01:00
parent 756c4cb6c3
commit b93b84c59c
2 changed files with 10 additions and 4 deletions

View File

@ -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.

View File

@ -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