--- # This playbook deploy OCP, both master and workers. # The main goal of this playbook is to be called as # a standalone piece of a bigger job, mostly in the # adoption context. # # You would typically run this playbook after the # "create-infra.yml" one, passing the exact same parameters. # # Make sure you passed the needed secrets to deploy OCP! - name: Parent scenario if needed hosts: "{{ cifmw_target_host | default('localhost') }}" gather_facts: true tasks: - name: Inherit from parent scenarios if needed ansible.builtin.include_tasks: file: "ci/playbooks/tasks/inherit_parent_scenario.yml" - name: Manage/generate unique ID ansible.builtin.import_playbook: playbooks/unique-id.yml - name: Run consistency checks ansible.builtin.import_playbook: "playbooks/adoption/pre.yml" - name: Prepare infrastructure datasets ansible.builtin.import_playbook: "playbooks/adoption/infra.yml" - name: Amend infrastructure datasets hosts: "{{ cifmw_target_host | default('localhost') }}" gather_facts: true tasks: # Filter out non-ocp vms, that are created, but not started by the # create-infra plabyook. # The rest are created by the create-infra playbook, and managing # them from here can cause problems in some environments, e.g # when running each playbook from a different zuul vm - name: Filter out non ocp vms from libvirt layout vars: _non_ocp_vms: >- {{ _cifmw_libvirt_manager_layout.vms | list | reject('match', '^ocp.*') }} ansible.builtin.set_fact: _cifmw_libvirt_manager_layout: >- {{ _cifmw_libvirt_manager_layout | ansible.utils.remove_keys(target=_non_ocp_vms) }} - name: Prepare networking ansible.builtin.import_playbook: "playbooks/adoption/network.yml" - name: OCP cluster hosts: "{{ cifmw_target_host | default('localhost') }}" gather_facts: true tasks: - name: Deploy OCP cluster ansible.builtin.import_role: name: "reproducer" tasks_from: "ocp_layout.yml" - name: Start OCP cluster based on its overlays ansible.builtin.import_role: name: "libvirt_manager" tasks_from: "deploy_layout.yml" # Run from the hypervisor - name: Ensure OCP cluster is stable vars: _auth_path: >- {{ ( cifmw_devscripts_repo_dir, 'ocp', cifmw_devscripts_config.cluster_name, 'auth' ) | ansible.builtin.path_join }} cifmw_openshift_adm_op: "stable" cifmw_openshift_kubeconfig: >- {{ (_auth_path, 'kubeconfig') | ansible.builtin.path_join }} ansible.builtin.include_role: name: openshift_adm