|
| 1 | +--- |
| 2 | +- name: "Run ci/playbooks/edpm_baremetal_update/run.yml" |
| 3 | + hosts: "{{ cifmw_zuul_target_host | default('all') }}" |
| 4 | + gather_facts: true |
| 5 | + tasks: |
| 6 | + - name: Filter out host if needed |
| 7 | + when: |
| 8 | + - cifmw_zuul_target_host is defined |
| 9 | + - cifmw_zuul_target_host != 'all' |
| 10 | + - inventory_hostname != cifmw_zuul_target_host |
| 11 | + ansible.builtin.meta: end_host |
| 12 | + |
| 13 | + - name: Check for edpm-ansible.yml file |
| 14 | + ansible.builtin.stat: |
| 15 | + path: "{{ ansible_user_dir }}/ci-framework-data/artifacts/edpm-ansible.yml" |
| 16 | + register: edpm_file |
| 17 | + |
| 18 | + - name: Check if new ssh keypair exists |
| 19 | + ansible.builtin.include_role: |
| 20 | + name: recognize_ssh_keypair |
| 21 | + |
| 22 | + - name: Add crc node in local inventory |
| 23 | + ansible.builtin.add_host: |
| 24 | + name: crc |
| 25 | + ansible_ssh_private_key_file: "{{ ansible_user_dir }}/.crc/machines/crc/{{ crc_ssh_keypair }}" |
| 26 | + ansible_ssh_user: core |
| 27 | + ansible_host: api.crc.testing |
| 28 | + |
| 29 | + - name: Ensure we know ssh hosts |
| 30 | + ansible.builtin.shell: |
| 31 | + cmd: "ssh-keyscan {{ hostvars[item].ansible_host }} >> ~/.ssh/known_hosts" |
| 32 | + loop: "{{ hostvars.keys() | reject('equalto', 'localhost') }}" |
| 33 | + |
| 34 | + - name: Inject CRC in zuul_inventory |
| 35 | + block: |
| 36 | + - name: Load zuul_inventory |
| 37 | + register: _inventory |
| 38 | + ansible.builtin.slurp: |
| 39 | + path: "{{ ansible_user_dir }}/ci-framework-data/artifacts/zuul_inventory.yml" |
| 40 | + |
| 41 | + - name: Inject CRC in zuul_inventory.yml |
| 42 | + vars: |
| 43 | + _crc: |
| 44 | + all: |
| 45 | + hosts: |
| 46 | + crc: "{{ dict(hostvars.crc) }}" |
| 47 | + _updated: >- |
| 48 | + {{ |
| 49 | + _inventory.content | b64decode | from_yaml | combine(_crc, recursive=true) |
| 50 | + }} |
| 51 | + ansible.builtin.copy: |
| 52 | + dest: "{{ ansible_user_dir }}/ci-framework-data/artifacts/zuul_inventory.yml" |
| 53 | + content: "{{ _updated | to_nice_yaml }}" |
| 54 | + mode: "0644" |
| 55 | + |
| 56 | + - name: Set default pre-update tag if not provided |
| 57 | + ansible.builtin.set_fact: |
| 58 | + cifmw_minor_update_pre_update_tag: "{{ cifmw_minor_update_pre_update_tag | default('18.0-fr3-latest') }}" |
| 59 | + |
| 60 | + - name: Get pre-update index image digest from tag |
| 61 | + ansible.builtin.shell: >- |
| 62 | + skopeo inspect |
| 63 | + docker://quay.io/openstack-k8s-operators/openstack-operator-index:{{ cifmw_minor_update_pre_update_tag }} |
| 64 | + | jq -r '.Digest' |
| 65 | + register: pre_update_digest_result |
| 66 | + changed_when: false |
| 67 | + failed_when: pre_update_digest_result.rc != 0 |
| 68 | + |
| 69 | + - name: Set pre-update index image using digest from tag |
| 70 | + ansible.builtin.set_fact: |
| 71 | + cifmw_minor_update_pre_update_index_image: >- |
| 72 | + quay.io/openstack-k8s-operators/openstack-operator-index@{{ pre_update_digest_result.stdout | trim }} |
| 73 | +
|
| 74 | + - name: Get minor update index image from content provider or use default |
| 75 | + ansible.builtin.set_fact: |
| 76 | + cifmw_minor_update_index_image: >- |
| 77 | + {{ |
| 78 | + cifmw_operator_build_output.operators['openstack-operator'].image_catalog |
| 79 | + if (cifmw_operator_build_output is defined and |
| 80 | + cifmw_operator_build_output.operators is defined and |
| 81 | + 'openstack-operator' in cifmw_operator_build_output.operators) |
| 82 | + else cifmw_minor_update_pre_update_index_image |
| 83 | + }} |
| 84 | +
|
| 85 | + - name: Override operator build output with pre-update index image for Phase 1 |
| 86 | + ansible.builtin.set_fact: |
| 87 | + cifmw_operator_build_output_pre_update: >- |
| 88 | + {{ |
| 89 | + { |
| 90 | + 'cifmw_operator_build_output': { |
| 91 | + 'operators': { |
| 92 | + 'openstack-operator': { |
| 93 | + 'image_catalog': cifmw_minor_update_pre_update_index_image |
| 94 | + } |
| 95 | + } |
| 96 | + } |
| 97 | + } |
| 98 | + }} |
| 99 | +
|
| 100 | + - name: Phase 1 - Deploy with pre-update index image using deploy-edpm.yml |
| 101 | + block: |
| 102 | + - name: Write pre-update operator build output to temporary file |
| 103 | + ansible.builtin.copy: |
| 104 | + dest: "{{ ansible_user_dir }}/ci-framework-data/artifacts/operator_build_output_pre_update.yml" |
| 105 | + content: "{{ cifmw_operator_build_output_pre_update | to_nice_yaml }}" |
| 106 | + mode: "0644" |
| 107 | + |
| 108 | + - name: Perform Podified and EDPM deployment on compute nodes with virtual baremetal (pre-update) |
| 109 | + ansible.builtin.command: |
| 110 | + chdir: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework" |
| 111 | + cmd: >- |
| 112 | + ansible-playbook deploy-edpm.yml |
| 113 | + -i "{{ ansible_user_dir }}/ci-framework-data/artifacts/zuul_inventory.yml" |
| 114 | + -e @group_vars/all.yml |
| 115 | + -e @scenarios/centos-9/base.yml |
| 116 | + -e @scenarios/centos-9/edpm_baremetal_deployment_ci.yml |
| 117 | + {%- if edpm_file.stat.exists %} |
| 118 | + -e @{{ ansible_user_dir }}/ci-framework-data/artifacts/edpm-ansible.yml |
| 119 | + {%- endif %} |
| 120 | + {%- if cifmw_extras is defined %} |
| 121 | + {%- for extra_var in cifmw_extras %} |
| 122 | + -e "{{ extra_var }}" |
| 123 | + {%- endfor %} |
| 124 | + {%- endif %} |
| 125 | + -e "@{{ ansible_user_dir }}/ci-framework-data/artifacts/parameters/zuul-params.yml" |
| 126 | + -e "@{{ ansible_user_dir }}/ci-framework-data/artifacts/operator_build_output_pre_update.yml" |
| 127 | + -e "cifmw_prepare_openstackversion=false" |
0 commit comments