bifrost/roles/ironic-deploy/tasks/main.yml

38 lines
2.1 KiB
YAML

---
- name: "Error if variable baremetal_csv_file is not defined"
local_action: fail msg="baremetal_csv_file must be defined for this playbook to execute, please pass option '-e baremetal_csv_file=<path/to/file>'"
when: baremetal_csv_file is not defined
- name: "Validate that CSV file exists"
local_action: stat path={{ baremetal_csv_file }}
register: test_baremetal_csv_file
- name: "Error if file does not exist."
local_action: fail msg="The variable defined for baremetal_csv_file is not to a file. Please define a file and try again."
when: test_baremetal_csv_file.stat.isreg == false
- name: "Verify CoreOS kernel is present."
local_action: stat path={{ http_boot_folder }}/coreos_production_pxe.vmlinuz
register: test_core_os_kernel_present
- name: "Error if the CoreOS kernel is missing."
local_action: fail msg="CoreOS kernel not found. Consider re-running setup."
when: test_core_os_kernel_present.stat.exists == false
- name: "Verify CoreOS ramdisk is present."
local_action: stat path={{ http_boot_folder }}/coreos_production_pxe_image-oem.cpio.gz
register: test_core_os_image_present
- name: "Error if the CoreOS ramdisk is missing."
local_action: fail msg="CoreOS ramdisk was not found. Consider re-running setup."
when: test_core_os_image_present.stat.exists == false
- name: "Verify that deployment image is present."
local_action: stat path={{deploy_image}}
register: test_deploy_image
# TODO: checksum for the above stat operation will be required for deployment.
- name: "Error if deployment image is missing."
local_action: fail msg="Deployment image is missing. Consider re-running setup."
when: test_deploy_image.stat.exists == false
- name: "Check to see if there is a file where the ssh_key_path is defined"
local_action: stat path={{ ssh_public_key_path }}
register: test_ssh_public_key_path
- name: "Error if ssh_public_key_path is not valid"
local_action: fail msg="ssh_public_key_path is not valid."
when: test_ssh_public_key_path.stat.exists == false
- name: "Read ssh public key in"
local_action: set_fact ssh_public_key="{{ lookup('file', ssh_public_key_path ) }}"