---
- name: create a comptatible deployment scripts from oooq
  include_tasks: ../upgrade/use_oooq.yaml
  args:
    apply:
      tags:
        - use_oooq
  tags: use_oooq
  when: use_oooq|bool

- name: Convert CLI options to parameters
  import_tasks: ../common/convert_cli_opts_params.yaml

- name: get auxiliary facts for major upgrades
  import_tasks: ../common/auxilary-facts.yaml

# TODO: Not comptatible with oooq
- name: Build extra templates based on new options.
  import_tasks: ../common/build_extra_template.yaml
  when: not use_oooq|bool

- name: create update workaround scripts
  template:
    src: workarounds.sh.j2
    dest: "{{ working_dir }}/{{ item }}.sh"
    mode: 0775
    force: true
  loop:
    - 'pre_overcloud_update_prepare_workarounds'
    - 'post_overcloud_update_prepare_workarounds'
    - 'pre_overcloud_update_run_workarounds'
    - 'post_overcloud_update_run_workarounds'
    - 'pre_overcloud_update_converge_workarounds'
    - 'post_overcloud_update_converge_workarounds'
  when: updates_workarounds|bool

- name: include l3 agent tasks
  import_tasks: ../common/create_l3_agent_connectivity_check_script.yml

- name: generate roles list from inventory file
  import_tasks: ../common/load_roles_from_inventory.yaml

- name: create overcloud update prepare script
  template:
    src: "{{ overcloud_update_prepare_template }}"
    dest: "{{ overcloud_update_prepare_script }}"
    mode: 0775
    force: true

- name: create overcloud update script
  template:
    src: "{{ overcloud_update_run_template }}"
    dest: "{{ overcloud_update_run_script_base }}-{{ item }}.sh"
    mode: 0775
    force: true
  loop: "{{ oc_roles|default(['all']) }}"

- name: create overcloud update converge script
  template:
    src: "{{ overcloud_update_converge_template }}"
    dest: "{{ overcloud_update_converge_script }}"
    mode: 0775
    force: true

- name: create docker container/images validate scripts
  template:
    src: "{{ overcloud_validate_images_template }}"
    dest: "{{ overcloud_validate_images_script }}"
    mode: 0755
    force: true

- name: create ceph update script
  template:
    src: "ceph-update-run.sh.j2"
    dest: "{{ working_dir }}/ceph-update-run.sh"
    mode: 0755
    force: true

- name: Create L3-agent failover scripts
  import_tasks: ../common/create_l3_agent_failover_check_script.yml

- name: create nova actions check script
  import_tasks: ../common/create_nova_actions_check_script.yml

- name: import create HTTP test scripts
  import_tasks: ../common/create_http_test_scripts.yml
