Check for existing baremetal deployed path

If an output file already exists at the requested baremetal deployed
path fail the playbook unless overwrite:true. overwrite is a new
playbook var.

Change-Id: I28f0b6399ced8c185c04e2e6a7dd7906e2eaadd4
Signed-off-by: James Slagle <jslagle@redhat.com>
(cherry picked from commit 8555bef675)
This commit is contained in:
James Slagle 2022-02-23 14:54:34 -05:00
parent 92ebc5c62a
commit 6f343c58cd
1 changed files with 9 additions and 0 deletions

View File

@ -27,6 +27,7 @@
python_interpreter: null
ssh_private_key_file: /home/stack/.ssh/id_rsa
templates: /usr/share/openstack-tripleo-heat-templates
overwrite: false
pre_tasks:
- fail:
@ -41,6 +42,14 @@
msg: baremetal_deployed_path is a required input
when:
- baremetal_deployed_path is undefined
- name: Check if baremetal deployment file already exist
stat:
path: "{{ baremetal_deployed_path }}"
register: stat_baremetal_deployed_path_file
- fail:
msg: "Output file {{ baremetal_deployed_path }} already exists"
when:
- stat_baremetal_deployed_path_file.stat.exists and not overwrite|bool
tasks:
- name: Detect default overcloud-full image