--- # # NOTE: Playbook migrated to: roles/cifmw_setup/tasks/deploy_architecture.yml # DO NOT EDIT THIS PLAYBOOK. IT WILL BE REMOVED IN NEAR FUTURE. # - name: Deploy an architecture-based scenario hosts: "{{ cifmw_target_host | default('localhost') }}" tasks: - name: Run pre_deploy hooks when: - cifmw_architecture_scenario is defined vars: step: pre_deploy ansible.builtin.import_role: name: run_hook # end_play will end only current play, not the main edpm-deploy.yml - name: Early end if not architecture deploy tags: - always when: - cifmw_architecture_scenario is not defined ansible.builtin.meta: end_play - name: Load Networking Environment Definition tags: - always ansible.builtin.import_role: name: networking_mapper tasks_from: load_env_definition.yml - name: Fetch network facts tags: - always when: - "not item.startswith('ocp-')" ansible.builtin.setup: gather_subset: network delegate_facts: true delegate_to: "{{ item }}" loop: "{{ groups['all'] }}" loop_control: label: "{{ item }}" - name: Look for nova migration keypair file tags: - edpm_bootstrap register: _nova_key_file ansible.builtin.stat: path: "{{ cifmw_basedir }}/artifacts/nova_migration_key" - name: Ensure nova migration keypair details are propagated tags: - always vars: _ssh_file: >- {{ _nova_key_file.stat.path | default( (cifmw_basedir, 'artifacts', 'nova_migration_key') | ansible.builtin.path_join ) }} block: - name: Create nova migration keypair if does not exists when: - not _nova_key_file.stat.exists | default(false) community.crypto.openssh_keypair: comment: "nova migration" path: "{{ _ssh_file }}" type: "{{ cifmw_ssh_keytype | default('ecdsa') }}" size: "{{ cifmw_ssh_keysize | default(521) }}" - name: Try/catch block vars: # We want to match anything like: # - controller (in Zuul) # - controller-0.foo.com (FQDN) # - controller-0 (no FQDN) - compatibility match _ctl_data: >- {{ hostvars | dict2items | selectattr('key', 'match', '^(controller-0.*|controller)') | map(attribute='value') | first }} _ifaces_vars: >- {{ _ctl_data.ansible_interfaces | map('regex_replace', '^(.*)$', 'ansible_\1') }} _controller_host: "{{ _ctl_data.ansible_host }}" block: - name: Generate needed facts out of local files vars: _ctl_ifaces_vars: >- {{ _ctl_data | dict2items | selectattr('key', 'in', _ifaces_vars) }} _ipv4_network_data: >- {{ _ctl_ifaces_vars | selectattr('value.ipv4.address', 'defined') | selectattr('value.ipv4.address', 'equalto', _controller_host) | map(attribute='value.ipv4') | first | default({}) }} _ipv6_network_data: >- {{ _ctl_ifaces_vars | selectattr('value.ipv6.address', 'defined') | selectattr('value.ipv6.address', 'equalto', _controller_host) | map(attribute='value.ipv6') | first | default({}) }} _ipv4_sshd_ranges: >- {{ ( [cifmw_networking_env_definition.networks.ctlplane.network_v4] if cifmw_networking_env_definition.networks.ctlplane.network_v4 is defined else [] ) + ( [ _ipv4_network_data.network + '/' + _ipv4_network_data.prefix ] ) if (_ipv4_network_data | length > 0) else [] }} _ipv6_sshd_ranges: >- {{ ( [cifmw_networking_env_definition.networks.ctlplane.network_v6] if cifmw_networking_env_definition.networks.ctlplane.network_v6 is defined else [] ) + ( [ _ipv6_network_data.network + '/' + _ipv6_network_data.prefix ] ) if (_ipv6_network_data | length > 0) else [] }} ansible.builtin.set_fact: cifmw_ci_gen_kustomize_values_ssh_authorizedkeys: >- {{ lookup('file', '~/.ssh/id_cifw.pub', rstrip=False) }} cifmw_ci_gen_kustomize_values_ssh_private_key: >- {{ lookup('file', '~/.ssh/id_cifw', rstrip=False) }} cifmw_ci_gen_kustomize_values_ssh_public_key: >- {{ lookup('file', '~/.ssh/id_cifw.pub', rstrip=False) }} cifmw_ci_gen_kustomize_values_migration_pub_key: >- {{ lookup('file', _ssh_file ~ '.pub', rstrip=False)}} cifmw_ci_gen_kustomize_values_migration_priv_key: >- {{ lookup('file', _ssh_file, rstrip=False) }} cifmw_ci_gen_kustomize_values_sshd_ranges: >- {{ _ipv4_sshd_ranges + _ipv6_sshd_ranges }} rescue: - name: Debug _ctl_data ansible.builtin.debug: var: _ctl_data - name: Debug _ifaces_vars ansible.builtin.debug: var: _ifaces_vars - name: Fail for good ansible.builtin.fail: msg: >- Error detected. Check debugging output above. - name: Set cifmw_architecture_automation_file if not set before when: cifmw_architecture_automation_file is not defined ansible.builtin.set_fact: cifmw_architecture_automation_file: >- {{ ( cifmw_architecture_repo, 'automation/vars', cifmw_architecture_scenario~'.yaml' ) | ansible.builtin.path_join }} - name: Load architecture automation file tags: - edpm_deploy register: _automation ansible.builtin.slurp: path: "{{ cifmw_architecture_automation_file }}" - name: Prepare automation data tags: - edpm_deploy vars: _parsed: "{{ _automation.content | b64decode | from_yaml }}" ansible.builtin.set_fact: cifmw_deploy_architecture_steps: >- {{ _parsed['vas'][cifmw_architecture_scenario] }} - name: Check requirements tags: - edpm_bootstrap ansible.builtin.import_role: name: kustomize_deploy tasks_from: check_requirements.yml - name: Reduce OCP cluster size in architecture when: - groups['ocps'] | length == 1 ansible.builtin.import_role: name: kustomize_deploy tasks_from: reduce_ocp_cluster.yml tags: - edpm_bootstrap - name: Configure Storage Class ansible.builtin.import_role: name: ci_local_storage when: not cifmw_use_lvms | default(false) tags: - storage - edpm_bootstrap - name: Deploy OSP operators ansible.builtin.import_role: name: kustomize_deploy tasks_from: install_operators.yml tags: - operator - edpm_bootstrap - name: Update containers in deployed OSP operators vars: cifmw_update_containers_metadata: controlplane ansible.builtin.include_role: name: update_containers tags: - update_containers - edpm_bootstrap when: cifmw_ci_gen_kustomize_values_deployment_version is not defined - name: Update containers in deployed OSP operators using set_openstack_containers role when: - cifmw_set_openstack_containers | default(false) | bool - cifmw_ci_gen_kustomize_values_deployment_version is not defined ansible.builtin.include_role: name: set_openstack_containers tags: - set_openstack_containers - edpm_bootstrap - name: Configure LVMS Storage Class ansible.builtin.include_role: name: ci_lvms_storage when: cifmw_use_lvms | default(false) tags: - storage - edpm_bootstrap - name: Execute deployment steps tags: - edpm_deploy ansible.builtin.include_role: name: kustomize_deploy tasks_from: execute_step.yml apply: tags: - edpm_deploy loop: "{{ cifmw_deploy_architecture_steps.stages }}" loop_control: label: "{{ stage.path }}" loop_var: stage index_var: stage_id - name: Extract and install OpenStackControlplane CA ansible.builtin.import_role: role: install_openstack_ca tags: - openstack_ca - edpm_post - name: Run nova host discover process tags: - edpm_post environment: KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" PATH: "{{ cifmw_path }}" ansible.builtin.command: >- oc rsh -n "{{ cifmw_openstack_namespace }}" nova-cell0-conductor-0 nova-manage cell_v2 discover_hosts --verbose - name: Run post_deploy hooks when: - cifmw_architecture_scenario is defined vars: step: post_deploy ansible.builtin.import_role: name: run_hook - name: Validations workflow hosts: "{{ cifmw_target_host | default('localhost') }}" gather_facts: false tasks: - name: Run validations ansible.builtin.include_role: name: validations when: cifmw_execute_validations | default(false) | bool