Ensure that tasks fail early if there is no ssh public key configured
One of the most common causes of failure in an initial deployment is that the LXC hosts aren't configured with a ssh public key to implement into the container caches. This patch ensures that the play will fatally stop if this configuration has not been implemented. Change-Id: I167446eee35e40cde645873fbab7491f840dcd15
This commit is contained in:
parent
b8ea138ddb
commit
aaaaa641b8
@ -13,6 +13,23 @@
|
||||
# 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:
|
||||
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
|
||||
fail:
|
||||
msg: "Please set the lxc_container_ssh_key variable or ensure that the host has the file /root/.ssh/id_rsa.pub present."
|
||||
when:
|
||||
- lxc_container_ssh_key is undefined
|
||||
- not _ssh_key.stat.exists
|
||||
tags:
|
||||
- always
|
||||
|
||||
- name: Gather variables for each operating system
|
||||
include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
|
Loading…
Reference in New Issue
Block a user