diff --git a/deploy-edpm.yml b/deploy-edpm.yml index eee017477d..5e9b242921 100644 --- a/deploy-edpm.yml +++ b/deploy-edpm.yml @@ -145,14 +145,6 @@ ansible.builtin.import_role: name: run_hook - # FIXME:Earlier, where we were using import_playbook, the cifmw_architecture_scenario - # variable was not available in playbooks/06-deploy-architecture.yml, - # but by using import_playbook, the variables are parsed in different way, - # so instead of cifmw_architecture_scenario not being defined, it is defined - # and it is executing additional tasks, which should not. - # Temporary move the end_play here and let's improve the tasks execution - # where tasks execution would be merged into one if the tasks should - # be done on same host. - name: Early end if not architecture deploy tags: - always diff --git a/hooks/playbooks/ceph-deploy.yml b/hooks/playbooks/ceph-deploy.yml index 3356d85356..110db5944a 100644 --- a/hooks/playbooks/ceph-deploy.yml +++ b/hooks/playbooks/ceph-deploy.yml @@ -4,7 +4,6 @@ hosts: "{{ cifmw_target_hook_host | default('localhost') }}" gather_facts: false tasks: - - name: Debug cifmw_make_ceph_environment when: - cifmw_make_ceph_environment is defined @@ -13,10 +12,6 @@ # Since the hook injects the ansible.cfg in the ansible-playbook command, # we therefore should know where to look for the install_yamls_makes role. - # For the records, this role is generated in the 01-bootstrap.yml playbook - # (migrated to: roles/cifmw_setup/tasks/bootstrap.yml) - # by leveraging the install_yamls role and related modules, especially - # the generate_make_tasks. # And we can pass down the cifmw_make_ceph_environment set in the # environment of the main play. If we don't have anything for that param, # let's default to an empty hash. diff --git a/playbooks/01-bootstrap.yml b/playbooks/01-bootstrap.yml deleted file mode 100644 index 912aefd9a2..0000000000 --- a/playbooks/01-bootstrap.yml +++ /dev/null @@ -1,75 +0,0 @@ ---- -# -# NOTE: Playbook migrated to: cifmw_setup/tasks/bootstrap.yml. -# DO NOT EDIT THIS PLAYBOOK. IT WILL BE REMOVED IN NEAR FUTURE. -# -- name: Bootstrap playbook - hosts: "{{ cifmw_target_host | default('localhost') }}" - gather_facts: true - tasks: - - name: Set custom cifmw PATH reusable fact - tags: - - always - when: - - cifmw_path is not defined - ansible.builtin.set_fact: - cifmw_path: "{{ ansible_user_dir }}/.crc/bin:{{ ansible_user_dir }}/.crc/bin/oc:{{ ansible_user_dir }}/bin:{{ ansible_env.PATH }}" - cacheable: true - - - name: Get customized parameters - tags: - - always - ansible.builtin.set_fact: - ci_framework_params: >- - {{ - hostvars[inventory_hostname] | - dict2items | - selectattr("key", "match", - "^(cifmw|pre|post)_(?!install_yamls|openshift_token|openshift_login|openshift_kubeconfig).*") | - list | items2dict - }} - - - name: Install custom CAs as soon as possible - tags: - - bootstrap - - packages - ansible.builtin.import_role: - name: install_ca - - - name: Run repo_setup - tags: - - bootstrap - - packages - ansible.builtin.import_role: - name: repo_setup - - - name: Run ci_setup role - tags: - - bootstrap - ansible.builtin.import_role: - role: ci_setup - - - name: Prepare install_yamls make targets - when: - - cifmw_architecture_scenario is undefined - tags: - - bootstrap - ansible.builtin.include_role: - name: install_yamls - apply: - tags: - - bootstrap - - - name: Get latest image for future reference - tags: - - bootstrap - ansible.builtin.import_role: - role: discover_latest_image - - - name: Create artifacts with custom params - tags: - - always - ansible.builtin.copy: - mode: "0644" - dest: "{{ cifmw_basedir|default(ansible_user_dir ~ '/ci-framework-data') }}/artifacts/parameters/custom-params.yml" - content: "{{ ci_framework_params | to_nice_yaml }}" diff --git a/playbooks/02-infra.yml b/playbooks/02-infra.yml deleted file mode 100644 index 7042de3211..0000000000 --- a/playbooks/02-infra.yml +++ /dev/null @@ -1,146 +0,0 @@ ---- -# -# NOTE: Playbook migrated to: cifmw_setup/tasks/infra.yml. -# DO NOT EDIT THIS PLAYBOOK. IT WILL BE REMOVED IN NEAR FUTURE.. -# -- name: Run pre_infra hooks - hosts: "{{ cifmw_target_host | default('localhost') }}" - gather_facts: false - tasks: - - name: Run pre_infra hooks - vars: - step: pre_infra - ansible.builtin.import_role: - name: run_hook - -- name: Prepare host virtualization - hosts: "{{ ('virthosts' in groups) | ternary('virthosts', cifmw_target_host | default('localhost') ) }}" - tasks: - - name: Load parameters files - ansible.builtin.include_vars: - dir: "{{ cifmw_basedir }}/artifacts/parameters" - - - name: Ensure libvirt is present/configured - when: - - cifmw_use_libvirt is defined - - cifmw_use_libvirt | bool - ansible.builtin.include_role: - name: libvirt_manager - - - name: Perpare OpenShift provisioner node - when: - - cifmw_use_opn is defined - - cifmw_use_opn | bool - ansible.builtin.include_role: - name: openshift_provisioner_node - -- name: Prepare the platform - hosts: "{{ cifmw_target_host | default('localhost') }}" - gather_facts: false - tasks: - - name: Load parameters files - ansible.builtin.include_vars: - dir: "{{ cifmw_basedir }}/artifacts/parameters" - - - name: Load Networking Environment Definition - vars: - cifmw_networking_mapper_assert_env_load: false - ansible.builtin.import_role: - name: networking_mapper - tasks_from: load_env_definition.yml - - - name: Deploy OCP using Hive - when: - - cifmw_use_hive is defined - - cifmw_use_hive | bool - ansible.builtin.include_role: - name: hive - - - name: Prepare CRC - when: - - cifmw_use_crc is defined - - cifmw_use_crc | bool - ansible.builtin.include_role: - name: rhol_crc - - - name: Deploy OpenShift cluster using dev-scripts - when: - - cifmw_use_devscripts is defined - - cifmw_use_devscripts | bool - ansible.builtin.include_role: - name: devscripts - - - name: Login into Openshift cluster - tags: - - always - vars: - cifmw_openshift_login_force_refresh: true - ansible.builtin.import_role: - name: openshift_login - - - name: Setup Openshift cluster - ansible.builtin.import_role: - name: openshift_setup - - - name: Deploy Observability operator. - when: - - cifmw_deploy_obs is defined - - cifmw_deploy_obs | bool - ansible.builtin.include_role: - name: openshift_obs - - - name: Deploy Metal3 BMHs - when: - - cifmw_config_bmh is defined - - cifmw_config_bmh | bool - ansible.builtin.include_role: - name: deploy_bmh - - - name: Install certmanager operator role - when: - - cifmw_config_certmanager is defined - - cifmw_config_certmanager | bool - ansible.builtin.include_role: - name: cert_manager - - - name: Configure hosts networking using nmstate - when: - - cifmw_config_nmstate is defined - - cifmw_config_nmstate | bool - ansible.builtin.include_role: - name: ci_nmstate - - - name: Configure multus networks - when: - - cifmw_config_multus | default(false) | bool - ansible.builtin.include_role: - name: ci_multus - - - name: Deploy Sushy Emulator and configure controller as hypervisor - when: - - cifmw_enable_virtual_baremetal_support | default(false) | bool - block: - - name: Deploy Sushy Emulator service pod - vars: - cifmw_sushy_emulator_hypervisor_address: "{{ hostvars['controller'].ansible_host }}" - cifmw_sushy_emulator_hypervisor_target: controller - cifmw_sushy_emulator_install_type: ocp - ansible.builtin.include_role: - name: sushy_emulator - - - name: Setup Libvirt on controller - ansible.builtin.include_role: - name: libvirt_manager - - - name: Prepare container package builder - when: - - cifmw_pkg_build_list is defined - - cifmw_pkg_build_list | length > 0 - ansible.builtin.include_role: - name: pkg_build - - - name: Run post_infra hooks - vars: - step: post_infra - ansible.builtin.import_role: - name: run_hook diff --git a/playbooks/03-build-packages.yml b/playbooks/03-build-packages.yml deleted file mode 100644 index 32ab5def16..0000000000 --- a/playbooks/03-build-packages.yml +++ /dev/null @@ -1,32 +0,0 @@ ---- -# -# NOTE: Playbook migrated to: cifmw_setup/build_packages.yml. -# DO NOT EDIT THIS PLAYBOOK. IT WILL BE REMOVED IN NEAR FUTURE.. -# -- name: Build package playbook - hosts: "{{ cifmw_target_host | default('localhost') }}" - gather_facts: false - tasks: - - name: Run pre_package_build hooks - vars: - step: pre_package_build - ansible.builtin.import_role: - name: run_hook - - - name: Load parameters files - ansible.builtin.include_vars: - dir: "{{ cifmw_basedir }}/artifacts/parameters" - - - name: Build packages - when: - - cifmw_pkg_build_list is defined - - cifmw_pkg_build_list | length > 0 - ansible.builtin.import_role: - name: pkg_build - tasks_from: build.yml - - - name: Run post_package_build hooks - vars: - step: post_package_build - ansible.builtin.import_role: - name: run_hook diff --git a/playbooks/04-build-containers.yml b/playbooks/04-build-containers.yml deleted file mode 100644 index d943089a67..0000000000 --- a/playbooks/04-build-containers.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -# -# NOTE: Playbook migrated to: cifmw_setup/build_containers.yml. -# DO NOT EDIT THIS PLAYBOOK. IT WILL BE REMOVED IN NEAR FUTURE.. -# -- name: Build container playbook - hosts: "{{ cifmw_target_host | default('localhost') }}" - gather_facts: false - tasks: - - name: Run pre_container_build hooks - vars: - step: pre_container_build - ansible.builtin.import_role: - name: run_hook - - - name: Load parameters files - ansible.builtin.include_vars: - dir: "{{ cifmw_basedir }}/artifacts/parameters" - - - name: Nothing to do yet - ansible.builtin.debug: - msg: "No support for that step yet" - - - name: Run post_container_build hooks - vars: - step: post_container_build - ansible.builtin.import_role: - name: run_hook diff --git a/playbooks/05-build-operators.yml b/playbooks/05-build-operators.yml deleted file mode 100644 index a058ebd0ef..0000000000 --- a/playbooks/05-build-operators.yml +++ /dev/null @@ -1,33 +0,0 @@ ---- -# -# NOTE: Playbook migrated to: cifmw_setup/tasks/build_operators.yml. -# DO NOT EDIT THIS PLAYBOOK. IT WILL BE REMOVED IN NEAR FUTURE.. -# -- name: Build operators playbook - hosts: "{{ cifmw_target_host | default('localhost') }}" - gather_facts: false - environment: - PATH: "{{ cifmw_path }}" - tasks: - - name: Run pre_operator_build hooks - vars: - step: pre_operator_build - ansible.builtin.import_role: - name: run_hook - - - name: Load parameters files - ansible.builtin.include_vars: - dir: "{{ cifmw_basedir }}/artifacts/parameters" - - - name: Build operator and meta-operator - when: - - cifmw_operator_build_operators is defined - - cifmw_operator_build_operators | length > 0 - ansible.builtin.import_role: - name: operator_build - - - name: Run post_operator_build hooks - vars: - step: post_operator_build - ansible.builtin.import_role: - name: run_hook diff --git a/playbooks/06-deploy-architecture.yml b/playbooks/06-deploy-architecture.yml deleted file mode 100644 index 408e7acc9c..0000000000 --- a/playbooks/06-deploy-architecture.yml +++ /dev/null @@ -1,303 +0,0 @@ ---- -# -# 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 openstack - 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 diff --git a/playbooks/06-deploy-edpm.yml b/playbooks/06-deploy-edpm.yml deleted file mode 100644 index 2871748076..0000000000 --- a/playbooks/06-deploy-edpm.yml +++ /dev/null @@ -1,190 +0,0 @@ ---- -# -# NOTE: Playbook migrated to: cifmw_setup/tasks/deploy-edpm.yml. -# DO NOT EDIT THIS PLAYBOOK. IT WILL BE REMOVED IN NEAR FUTURE.. -# -- name: Deploy podified control plane - hosts: "{{ cifmw_target_host | default('localhost') }}" - gather_facts: false - tasks: - - name: Run pre_deploy hooks - when: - - cifmw_architecture_scenario is not 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 architecture deploy - when: - - cifmw_architecture_scenario is defined - ansible.builtin.meta: end_play - - - name: Load parameters files - ansible.builtin.include_vars: - dir: "{{ cifmw_basedir }}/artifacts/parameters" - - - name: Configure Storage Class - ansible.builtin.include_role: - name: ci_local_storage - when: not cifmw_use_lvms | default(false) - - - name: Configure LVMS Storage Class - ansible.builtin.include_role: - name: ci_lvms_storage - when: cifmw_use_lvms | default(false) - - - name: Run edpm_prepare - ansible.builtin.include_role: - name: edpm_prepare - - - name: Run post_ctlplane_deploy hooks - when: - - cifmw_architecture_scenario is undefined - vars: - step: post_ctlplane_deploy - ansible.builtin.import_role: - name: run_hook - -- name: EDPM deployment on virtual baremetal - hosts: "{{ cifmw_target_host | default('localhost') }}" - gather_facts: false - tasks: - # end_play will end only current play, not the main edpm-deploy.yml - - name: Early end if architecture deploy - when: - - cifmw_architecture_scenario is defined - ansible.builtin.meta: end_play - - - name: Load parameters files - ansible.builtin.include_vars: - dir: "{{ cifmw_basedir }}/artifacts/parameters" - - - name: Create virtual baremetal and deploy EDPM - when: - - cifmw_edpm_deploy_baremetal | default(false) | bool - - cifmw_deploy_edpm | default(false) | bool - ansible.builtin.import_role: - name: edpm_deploy_baremetal - -- name: EDPM deployment on pre-provisioned VMs - hosts: "{{ cifmw_target_host | default('localhost') }}" - gather_facts: false - tasks: - # end_play will end only current play, not the main edpm-deploy.yml - - name: Early end if architecture deploy - when: - - cifmw_architecture_scenario is defined - ansible.builtin.meta: end_play - - - name: Load parameters files - ansible.builtin.include_vars: - dir: "{{ cifmw_basedir }}/artifacts/parameters" - - - name: Create VMs and Deploy EDPM - when: - - not cifmw_edpm_deploy_baremetal | default(false) | bool - - cifmw_deploy_edpm | default(false) | bool - block: - - name: Create and provision external computes - when: - - cifmw_use_libvirt is defined - - cifmw_use_libvirt | bool - ansible.builtin.import_role: - name: libvirt_manager - tasks_from: deploy_edpm_compute.yml - - - name: Prepare for HCI deploy phase 1 - when: cifmw_edpm_deploy_hci | default(false) | bool - ansible.builtin.include_role: - name: hci_prepare - tasks_from: phase1.yml - - - name: Deploy EDPM - ansible.builtin.import_role: - name: edpm_deploy - -- name: Deploy NFS server on target nodes - become: true - hosts: "{{ groups[cifmw_nfs_target | default('computes')][0] | default([]) }}" - tasks: - - name: Run cifmw_nfs role - vars: - nftables_path: /etc/nftables - nftables_conf: /etc/sysconfig/nftables.conf - when: - - cifmw_edpm_deploy_nfs | default(false) | bool - ansible.builtin.import_role: - name: cifmw_nfs - -- name: Clear ceph target hosts facts to force refreshing in HCI deployments - hosts: "{{ cifmw_ceph_target | default('computes') }}" - tasks: - # end_play will end only current play, not the main edpm-deploy.yml - - name: Early end if architecture deploy - when: - - cifmw_architecture_scenario is defined - ansible.builtin.meta: end_play - - - name: Clear ceph target hosts facts - when: cifmw_edpm_deploy_hci | default(false) | bool - ansible.builtin.meta: clear_facts - -# NOTE: This playbook would be removed soon. -# Here is more like workaround to pass CI. -- name: Deploy Ceph on target nodes - vars: - _deploy_ceph: >- - {{ - (cifmw_edpm_deploy_hci | default(false) | bool) and - cifmw_architecture_scenario is undefined - }} - storage_network_range: 172.18.0.0/24 - storage_mgmt_network_range: 172.20.0.0/24 - ansible.builtin.import_playbook: ../hooks/playbooks/ceph.yml - -- name: Continue HCI deploy - hosts: "{{ cifmw_target_host | default('localhost') }}" - gather_facts: false - tasks: - # end_play will end only current play, not the main edpm-deploy.yml - - name: Early end if architecture deploy - when: - - cifmw_architecture_scenario is defined - ansible.builtin.meta: end_play - - - name: Create Ceph secrets and retrieve FSID info - when: cifmw_edpm_deploy_hci | default(false) | bool - block: - - name: Prepare for HCI deploy phase 2 - ansible.builtin.include_role: - name: hci_prepare - tasks_from: phase2.yml - - - name: Continue HCI deployment - ansible.builtin.include_role: - name: edpm_deploy - vars: - cifmw_edpm_deploy_prepare_run: false - - - name: Run post_deploy hooks - when: - - cifmw_architecture_scenario is not defined - vars: - step: post_deploy - ansible.builtin.import_role: - name: run_hook - -- name: Validations workflow - # If we're doing an architecture deployment, we need to skip validations here. - # Instead, they will be executed in the 06-deploy-architecture.yml playbook. - hosts: "{{ cifmw_target_host | default('localhost') }}" - gather_facts: false - tasks: - - name: Run validations - ansible.builtin.include_role: - name: validations - when: - - cifmw_architecture_scenario is not defined - - cifmw_execute_validations | default(false) | bool diff --git a/playbooks/07-admin-setup.yml b/playbooks/07-admin-setup.yml deleted file mode 100644 index 82e98097f9..0000000000 --- a/playbooks/07-admin-setup.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -# -# NOTE: Playbook migrated to: cifmw_setup/tasks/admin_setup.yml. -# DO NOT EDIT THIS PLAYBOOK. IT WILL BE REMOVED IN NEAR FUTURE.. -# -- name: Post-deployment admin setup steps - hosts: "{{ cifmw_target_host | default('localhost') }}" - gather_facts: false - tasks: - - name: Run pre_admin_setup hooks - vars: - step: pre_admin_setup - ansible.builtin.import_role: - name: run_hook - - - name: Load parameters files - ansible.builtin.include_vars: - dir: "{{ cifmw_basedir }}/artifacts/parameters" - - - name: Create openstack network elements - ansible.builtin.import_role: - name: os_net_setup - when: not cifmw_skip_os_net_setup | default(false) | bool - - - name: Run post_admin_setup hooks - vars: - step: post_admin_setup - ansible.builtin.import_role: - name: run_hook diff --git a/playbooks/09-compliance.yml b/playbooks/09-compliance.yml deleted file mode 100644 index 6e9f9dc013..0000000000 --- a/playbooks/09-compliance.yml +++ /dev/null @@ -1,27 +0,0 @@ ---- -# -# NOTE: Playbook migrated to: deploy-edpm.yml#L96-119. -# DO NOT EDIT THIS PLAYBOOK. IT WILL BE REMOVED IN NEAR FUTURE.. -# -- name: Run operators compliance scans - hosts: "{{ cifmw_target_host | default('localhost') }}" - gather_facts: false - tasks: - - name: Run compliance scan for controllers - ansible.builtin.import_role: - name: compliance - vars: - cifmw_compliance_podman_username: "{{ cifmw_registry_token.credentials.username }}" - cifmw_compliance_podman_password: "{{ cifmw_registry_token.credentials.password }}" - when: cifmw_run_operators_compliance_scans | default(false) | bool - -- name: Run compliance scan for computes - hosts: "{{ groups['computes'] | default ([]) }}" - gather_facts: true - tasks: - - name: Run compliance scan for one compute - ansible.builtin.import_role: - name: compliance - tasks_from: run_compute_node_scans.yml - run_once: true - when: cifmw_run_compute_compliance_scans | default(false) | bool diff --git a/playbooks/99-logs.yml b/playbooks/99-logs.yml deleted file mode 100644 index 54bbe6d57b..0000000000 --- a/playbooks/99-logs.yml +++ /dev/null @@ -1,117 +0,0 @@ -# -# NOTE: Playbook migrated to: cifmw_setup/tasks/run_logs.yml -# DO NOT EDIT THAT PLAYBOOK. IT WOULD BE REMOVED IN NEAR FUTURE. -# - -- name: Logging playbook - hosts: "{{ cifmw_target_host | default('localhost') }}" - gather_facts: true - tasks: - # end_play will end only current play, not the main edpm-deploy.yml - - name: Early exit if no tests - when: - - zuul_log_collection | default(false) | bool - ansible.builtin.meta: end_play - - - name: Ensure cifmw_basedir param is set - when: - - cifmw_basedir is not defined - ansible.builtin.set_fact: - cifmw_basedir: "{{ ansible_user_dir }}/ci-framework-data" - - - name: Try to load parameters files - block: - - name: Check directory availabilty - register: param_dir - ansible.builtin.stat: - path: "{{ cifmw_basedir }}/artifacts/parameters" - - - name: Load parameters files - when: - - param_dir.stat.exists | bool - ansible.builtin.include_vars: - dir: "{{ cifmw_basedir }}/artifacts/parameters" - always: - - name: Set custom cifmw PATH reusable fact - when: - - cifmw_path is not defined - ansible.builtin.set_fact: - cifmw_path: "{{ ansible_user_dir }}/.crc/bin:{{ ansible_user_dir }}/.crc/bin/oc:{{ ansible_user_dir }}/bin:{{ ansible_env.PATH }}" - cacheable: true - - - name: Set destination folder for the logs - ansible.builtin.set_fact: - logfiles_dest_dir: >- - {{ - ( - cifmw_basedir | default(ansible_user_dir ~ '/ci-framework-data'), - 'logs/', - now(fmt='%Y-%m-%d_%H-%M') - ) | path_join - }} - - - name: Generate artifacts - ansible.builtin.import_role: - name: artifacts - - - name: Collect container images used in the environment - ansible.builtin.import_role: - name: env_op_images - - - name: Create a versioned log folder - ansible.builtin.file: - path: "{{ logfiles_dest_dir }}" - state: directory - mode: "0775" - - - name: Return a list of log files in home directory - ansible.builtin.find: - paths: "{{ ansible_user_dir }}" - patterns: '*.log' - register: _log_files - - - name: Ensure ansible facts cache exists - register: ansible_facts_cache_state - ansible.builtin.stat: - path: "{{ ansible_user_dir }}/ansible_facts_cache" - - - name: Copy log files - when: - - _log_files.matched > 0 - block: - - name: Copy logs to proper location - ansible.builtin.copy: - src: "{{ item.path }}" - dest: "{{ [ logfiles_dest_dir , item.path | basename ] | path_join }}" - remote_src: true - mode: "0666" - loop: "{{ _log_files.files }}" - - - name: Remove original log from home directory - ansible.builtin.file: - path: "{{ item.path }}" - state: absent - loop: "{{ _log_files.files }}" - - - name: Copy Ansible facts if exists - when: - - ansible_facts_cache_state.stat.exists is defined - - ansible_facts_cache_state.stat.exists | bool - block: - - name: Copy facts to dated directory - ansible.builtin.copy: - src: "{{ ansible_user_dir }}/ansible_facts_cache" - dest: >- - {{ - ( - cifmw_basedir|default(ansible_user_dir ~ '/ci-framework-data'), - "artifacts/ansible_facts." + now(fmt='%Y-%m-%d_%H-%M') - ) | path_join - }} - mode: "0777" - remote_src: true - - - name: Clean ansible fact cache - ansible.builtin.file: - path: "{{ ansible_user_dir }}/ansible_facts_cache" - state: absent diff --git a/playbooks/validations.yml b/playbooks/validations.yml index 9d115404e5..581a748e3a 100644 --- a/playbooks/validations.yml +++ b/playbooks/validations.yml @@ -1,4 +1,5 @@ -# +--- +# TODO: remove this playbook. # NOTE: Playbook migrated to: roles/cifmw_setup/tasks/hci_deploy.yml & # 06-deploy-architecture.yml. # This migration is temporary, and will be further migrated to role. diff --git a/roles/ci_lvms_storage/README.md b/roles/ci_lvms_storage/README.md index 3a7efbb371..bd3c9e2dc4 100644 --- a/roles/ci_lvms_storage/README.md +++ b/roles/ci_lvms_storage/README.md @@ -31,7 +31,7 @@ clean and adds to an LVMS cluster. If the ci-framework is called and `cifmw_use_lvms` is true, then the tasks in role `roles/cifmw_setup/tasks/deploy_architecture.yml` -and playbook `06-deploy-edpm.yml` call the `ci_lvms_storage` role to create +and `cifmw_setup/tasks/deploy-edpm.yml` call the `ci_lvms_storage` role to create a storage class called `lvms-local-storage` and the `ci_gen_kustomize_values` role will set the `storageClass` to `lvms-local-storage` in the generated values.yaml files used to build architecture CRs. The Tempest @@ -39,10 +39,10 @@ CR file, created by the `test_operator` role, will also set its `storageClass` value to `lvms-local-storage`. If the ci-framework is called and `cifmw_use_lvms` is false, then the -tasks in role `roles/cifmw_setup/tasks/deploy_architecture.yml` and playbook -`06-deploy-edpm.yml` call the `ci_local_storage` role to create a storage class -called `local-storage` and the `ci_gen_kustomize_values` role will set -the `storageClass` to `local-storage` in the generated values.yaml +tasks in role `roles/cifmw_setup/tasks/deploy_architecture.yml` and +`cifmw_setup/tasks/deploy-edpm.yml` call the `ci_local_storage` role to create +a storage class called `local-storage` and the `ci_gen_kustomize_values` role +will set the `storageClass` to `local-storage` in the generated values.yaml files used to build architecture CRs. The Tempest CR file, created by the `test_operator` role, will also set its `storageClass` value to `local-storage`. diff --git a/roles/cifmw_setup/tasks/hci_deploy.yml b/roles/cifmw_setup/tasks/hci_deploy.yml index 4fb752d43e..fa014b01f5 100644 --- a/roles/cifmw_setup/tasks/hci_deploy.yml +++ b/roles/cifmw_setup/tasks/hci_deploy.yml @@ -23,7 +23,7 @@ name: run_hook # If we're doing an architecture deployment, we need to skip validations here. -# Instead, they will be executed in the 06-deploy-architecture.yml playbook. +# Instead, they will be executed in the roles/cifmw_setup/tasks/deploy_architecture.yml - name: Run validations ansible.builtin.include_role: name: validations diff --git a/roles/reproducer/tasks/reuse_main.yaml b/roles/reproducer/tasks/reuse_main.yaml index db5630a924..c97b10a6db 100644 --- a/roles/reproducer/tasks/reuse_main.yaml +++ b/roles/reproducer/tasks/reuse_main.yaml @@ -116,18 +116,25 @@ loop: - "{{ cifmw_reproducer_controller_user_dir }}/ansible-bootstrap.log" + - name: Read inventory file and add it using add_host module + vars: + include_inventory_file: "{{ ansible_user_dir }}/ci-framework-data/artifacts/zuul_inventory.yml" + ansible.builtin.include_role: + name: cifmw_helpers + tasks_from: inventory_file.yml + - name: Bootstrap environment on controller-0 environment: - ANSIBLE_LOG_PATH: "~/ansible-bootstrap.log" + ANSIBLE_LOG_PATH: "{{ ansible_user_dir }}/ansible-bootstrap.log" no_log: "{{ cifmw_nolog | default(true) | bool }}" - ansible.builtin.command: - chdir: "{{ _cifmw_reproducer_framework_location }}" - cmd: >- - ansible-playbook -i ~/ci-framework-data/artifacts/zuul_inventory.yml - -e @~/ci-framework-data/parameters/reproducer-variables.yml - -e @scenarios/reproducers/networking-definition.yml - playbooks/01-bootstrap.yml - creates: "{{ cifmw_reproducer_controller_user_dir }}/ansible-bootstrap.log" + ansible.builtin.import_role: + name: cifmw_setup + tasks_from: bootstrap.yml + vars: + ansible_extra_vars: + - "{{ ansible_user_dir }}/ci-framework-data/parameters/reproducer-variables.yml" + - "scenarios/reproducers/networking-definition.yml" + changed_when: false - name: Install dev tools from install_yamls on controller-0 environment: diff --git a/scenarios/centos-9/ci.yml b/scenarios/centos-9/ci.yml index 95e9357bb7..4374dd8ed6 100644 --- a/scenarios/centos-9/ci.yml +++ b/scenarios/centos-9/ci.yml @@ -7,7 +7,7 @@ cifmw_openshift_setup_skip_internal_registry: true pre_infra: - name: Download needed tools - inventory: 'localhost,' + inventory: "localhost," connection: local type: playbook source: "{{ cifmw_installyamls_repos }}/devsetup/download_tools.yaml" @@ -31,8 +31,7 @@ cifmw_run_tests: true # The actual ceph_make task understands "make_ceph_environment". # But since we're calling it via hook, in order to expose it properly, we # have to prefix it with "cifmw_". It will then end in the generated file from -# 01-bootstrap.yml playbook (custom-params.yml; migrated to -# roles/cifmw_setup/tasks/bootstrap.yml), and the hook will be able +# roles/cifmw_setup/tasks/bootstrap.yml, and the hook will be able # to load it and consume the parameters properly # Check hooks/playbooks/ceph-deploy.yml for the whole logic. cifmw_make_ceph_environment: diff --git a/zuul.d/adoption.yaml b/zuul.d/adoption.yaml index cdce1c15bf..156c09970c 100644 --- a/zuul.d/adoption.yaml +++ b/zuul.d/adoption.yaml @@ -118,8 +118,6 @@ parent: adoption-standalone-to-crc-ceph files: # ci-framework - - ^playbooks/02-infra.yml - - ^playbooks/06-deploy-edpm.yml - ^roles/discover_latest_image/.* - ^roles/edpm_prepare/.* - ^roles/install_ca/.* diff --git a/zuul.d/edpm_multinode.yaml b/zuul.d/edpm_multinode.yaml index b299ec03a8..9147b94283 100644 --- a/zuul.d/edpm_multinode.yaml +++ b/zuul.d/edpm_multinode.yaml @@ -362,7 +362,6 @@ - ^hooks/playbooks/control_plane_ceph_backends.yml - ^hooks/playbooks/control_plane_hci_pre_deploy.yml - ^hooks/playbooks/templates/config_ceph_backends.yaml.j2 - - ^playbooks/06-deploy-edpm.yml - ^roles/edpm_deploy/(defaults|files|handlers|library|lookup_plugins|module_utils|tasks|templates|vars).* - ^roles/hci_prepare/(defaults|files|handlers|library|lookup_plugins|module_utils|tasks|templates|vars).* - ^roles/cifmw_ceph.*/(defaults|files|handlers|library|lookup_plugins|module_utils|tasks|templates|vars).*