--- # Copyright Red Hat, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. - name: Define minimal set of repo variables when not running on Zuul when: - zuul is not defined - cifmw_operator_build_output is defined - cifmw_operator_build_meta_name in operators_build_output.operators tags: - always vars: operators_build_output: "{{ (cifmw_operator_build_output | default({'operators':{}})).operators }}" ansible.builtin.set_fact: _install_yamls_repos: OPENSTACK_BRANCH: "" GIT_CLONE_OPTS': "-l" OPENSTACK_REPO': "{{ operators_build_output[cifmw_operator_build_meta_name].git_src_dir }}" - name: Set install_yamls Makefile environment variables tags: - always vars: operators_build_output: "{{ (cifmw_operator_build_output | default({'operators':{}})).operators }}" ansible.builtin.set_fact: cifmw_edpm_prepare_common_env: >- {{ cifmw_install_yamls_environment | combine({'PATH': cifmw_path}) | combine(_install_yamls_repos | default({})) | combine(cifmw_edpm_prepare_extra_vars | default({})) }} cifmw_edpm_prepare_make_openstack_env: | {% if cifmw_operator_build_meta_name is defined and cifmw_operator_build_meta_name in operators_build_output %} OPENSTACK_IMG: {{ operators_build_output[cifmw_operator_build_meta_name].image_catalog }} {% endif %} cifmw_edpm_prepare_make_openstack_deploy_prep_env: | CLEANUP_DIR_CMD: "true" cifmw_edpm_prepare_operators_build_output: "{{ operators_build_output }}" - name: Prepare storage in CRC when: - not cifmw_edpm_prepare_skip_crc_storage_creation | bool vars: make_crc_storage_env: "{{ cifmw_edpm_prepare_common_env }}" make_crc_storage_dryrun: "{{ cifmw_edpm_prepare_dry_run }}" make_crc_storage_retries: 10 make_crc_storage_delay: 2 make_crc_storage_until: "make_crc_storage_status is not failed" ansible.builtin.include_role: name: 'install_yamls_makes' tasks_from: 'make_crc_storage' tags: - control-plane - name: Prepare inputs vars: make_input_env: "{{ cifmw_edpm_prepare_common_env }}" make_input_dryrun: "{{ cifmw_edpm_prepare_dry_run }}" make_input_retries: 10 make_input_delay: 5 make_input_until: "make_input_status is not failed" ansible.builtin.include_role: name: 'install_yamls_makes' tasks_from: 'make_input' tags: - control-plane - name: OpenStack meta-operator installation vars: make_openstack_env: "{{ cifmw_edpm_prepare_common_env | combine(cifmw_edpm_prepare_make_openstack_env | from_yaml)}}" make_openstack_dryrun: "{{ cifmw_edpm_prepare_dry_run }}" ansible.builtin.include_role: name: 'install_yamls_makes' tasks_from: 'make_openstack' tags: - control-plane - name: Wait for OpenStack operators to be installed tags: - control-plane when: - not cifmw_edpm_prepare_dry_run block: - name: Wait for OpenStack subscription creation environment: KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" PATH: "{{ cifmw_path }}" ansible.builtin.command: cmd: >- oc get sub openstack-operator --namespace={{ cifmw_install_yamls_defaults['OPERATOR_NAMESPACE'] }} -o=jsonpath='{.status.installplan.name}' until: cifmw_edpm_prepare_wait_installplan_out.rc == 0 and cifmw_edpm_prepare_wait_installplan_out.stdout != "" register: cifmw_edpm_prepare_wait_installplan_out retries: "{{ cifmw_edpm_prepare_oc_retries }}" delay: "{{ cifmw_edpm_prepare_oc_delay }}" - name: Wait for OpenStack operator to get installed environment: KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" PATH: "{{ cifmw_path }}" ansible.builtin.command: cmd: >- oc wait InstallPlan {{ cifmw_edpm_prepare_wait_installplan_out.stdout }} --namespace={{ cifmw_install_yamls_defaults['OPERATOR_NAMESPACE'] }} --for=jsonpath='{.status.phase}'=Complete --timeout=20m - name: Check if the OpenStack initialization CRD exists when: - not cifmw_edpm_prepare_dry_run kubernetes.core.k8s_info: kubeconfig: "{{ cifmw_openshift_kubeconfig }}" api_key: "{{ cifmw_openshift_token | default(omit) }}" context: "{{ cifmw_openshift_context | default(omit) }}" kind: CustomResourceDefinition name: openstacks.operator.openstack.org register: _cifmw_kustomize_deploy_olm_osp_operator_openstack_crd_out tags: - control-plane - name: OpenStack meta-operator initialization, if necessary when: - not cifmw_edpm_prepare_dry_run - _cifmw_kustomize_deploy_olm_osp_operator_openstack_crd_out is defined - _cifmw_kustomize_deploy_olm_osp_operator_openstack_crd_out.resources is defined - (_cifmw_kustomize_deploy_olm_osp_operator_openstack_crd_out.resources | length) > 0 vars: make_openstack_init_env: "{{ cifmw_edpm_prepare_common_env }}" make_openstack_init_dryrun: "{{ cifmw_edpm_prepare_dry_run }}" ansible.builtin.include_role: name: 'install_yamls_makes' tasks_from: 'make_openstack_init' tags: - control-plane # Note(chkumar): Keeping set_openstack_containers role # till we migrate this task to update_containers role - name: Update OpenStack Services containers Env when: - cifmw_edpm_prepare_update_os_containers | bool - not cifmw_update_containers_openstack | bool vars: cifmw_set_openstack_containers_extra_vars: "{{ cifmw_edpm_prepare_extra_vars }}" ansible.builtin.include_role: name: set_openstack_containers - name: Set facts for baremetal UEFI image url ansible.builtin.set_fact: cifmw_update_containers_edpm_image_url: "{{ cifmw_build_images_output['images']['edpm-hardened-uefi']['image'] }}" cacheable: true when: - cifmw_build_images_output is defined - cifmw_build_images_output.keys() | length > 0 # Prepare and kustomize the OpenStackControlPlane CR - name: Prepare OpenStack control plane CR vars: make_openstack_deploy_prep_env: "{{ cifmw_edpm_prepare_common_env | combine(cifmw_edpm_prepare_make_openstack_deploy_prep_env | from_yaml)}}" make_openstack_deploy_prep_dryrun: "{{ cifmw_edpm_prepare_dry_run }}" ansible.builtin.include_role: name: 'install_yamls_makes' tasks_from: 'make_openstack_deploy_prep' tags: - control-plane - name: Deploy NetConfig vars: make_netconfig_deploy_env: "{{ cifmw_edpm_prepare_common_env }}" make_netconfig_deploy_dryrun: "{{ cifmw_edpm_prepare_dry_run }}" ansible.builtin.include_role: name: 'install_yamls_makes' tasks_from: 'make_netconfig_deploy' tags: - control-plane - name: Kustomize and deploy OpenStackControlPlane tags: - control-plane when: not cifmw_edpm_prepare_dry_run ansible.builtin.include_tasks: kustomize_and_deploy.yml - name: Extract and install OpenStackControlplane CA tags: - control-plane when: not cifmw_edpm_prepare_dry_run vars: cifmw_install_openstack_ca_dest_path: "{{ cifmw_edpm_prepare_basedir }}" ansible.builtin.include_role: role: install_openstack_ca - name: Wait for keystone to be ready tags: - control-plane when: not cifmw_edpm_prepare_dry_run block: - name: Extract keystone endpoint host environment: KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" PATH: "{{ cifmw_path }}" ansible.builtin.command: cmd: >- oc get keystoneapi keystone --namespace={{ cifmw_install_yamls_defaults['NAMESPACE'] }} -o jsonpath='{ .status.apiEndpoints.public }' register: _cifmw_edpm_prepare_keystone_endpoint_out until: _cifmw_edpm_prepare_keystone_endpoint_out.rc == 0 and _cifmw_edpm_prepare_keystone_endpoint_out.stdout != "" retries: "{{ cifmw_edpm_prepare_oc_retries }}" delay: "{{ cifmw_edpm_prepare_oc_delay }}" - name: Wait for keystone endpoint to exist in DNS register: _cifmw_edpm_prepare_check_keystone_dns vars: _keystone_response_codes: [200, 300, 301, 302, 401, 402, 403] ansible.builtin.uri: url: "{{ _cifmw_edpm_prepare_keystone_endpoint_out.stdout | trim }}" status_code: "{{ _keystone_response_codes }}" # noqa: args[module] validate_certs: "{{ cifmw_edpm_prepare_verify_tls }}" retries: 20 delay: 10 until: - _cifmw_edpm_prepare_check_keystone_dns.status is defined - _cifmw_edpm_prepare_check_keystone_dns.status in _keystone_response_codes