---
- name: Prepare
  hosts: all
  gather_facts: false
  tasks:
    - name: Ensure ironic inspector kernel and ramdisk image directory exists
      local_action:
        module: file
        path: "{{ item | dirname }}"
        state: directory
        recurse: true
      with_items:
        - "{{ kolla_inspector_ipa_kernel_path }}"
        - "{{ kolla_inspector_ipa_ramdisk_path }}"

    # NOTE(mgoddard): Previously we were creating empty files for the kernel
    # and ramdisk, but this was found to cause ansible to hang on recent
    # versions of docker. Using non-empty files seems to resolve the issue.
    # See https://github.com/ansible/ansible/issues/36725.
    - name: Ensure ironic inspector kernel and ramdisk images exist
      local_action:
        module: copy
        content: fake image
        dest: "{{ item }}"
      with_items:
        - "{{ kolla_inspector_ipa_kernel_path }}"
        - "{{ kolla_inspector_ipa_ramdisk_path }}"
