Merge "Ensure that tasks fail early if there is no ssh public key configured"
This commit is contained in:
commit
0438a41233
@ -13,6 +13,23 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# 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
|
- name: Gather variables for each operating system
|
||||||
include_vars: "{{ item }}"
|
include_vars: "{{ item }}"
|
||||||
with_first_found:
|
with_first_found:
|
||||||
|
Loading…
Reference in New Issue
Block a user