--- # 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: Run HCI common tasks ansible.builtin.import_tasks: common.yml - name: Ensure directories ansible.builtin.file: path: "{{ item }}" state: directory mode: "0755" loop: - "{{ cifmw_hci_prepare_basedir }}/artifacts" - "{{ cifmw_hci_prepare_dataplane_dir }}" - name: Create Ceph secrets and configure Nova environment: PATH: "{{ cifmw_path }}" KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" when: not cifmw_hci_prepare_dryrun block: - name: Create ceph config secret cifmw.general.ci_script: output_dir: "{{ cifmw_hci_prepare_basedir }}/artifacts" script: "oc apply -f {{ cifmw_hci_prepare_ceph_secret_path }}" - name: Set Ceph FSID fact ansible.builtin.set_fact: cifmw_hci_prepare_ceph_fsid: "{{ (lookup('template', cifmw_hci_prepare_ceph_secret_path)|from_yaml).data['ceph.conf'] \ | b64decode | regex_search('fsid = (.*)', '\\1') | first | trim }}" - name: Generate nova config map ansible.builtin.template: src: templates/configmap-ceph-nova.yml.j2 dest: "{{ cifmw_hci_prepare_basedir }}/artifacts/configmap-ceph-nova.yml" mode: "0644" - name: Create nova config map cifmw.general.ci_script: output_dir: "{{ cifmw_hci_prepare_basedir }}/artifacts" script: "oc apply -f {{ cifmw_hci_prepare_basedir }}/artifacts/configmap-ceph-nova.yml" - name: Generate Ceph-Nova Dataplane Service ansible.builtin.template: src: templates/dpservice-nova-custom-ceph.yml.j2 dest: "{{ cifmw_hci_prepare_basedir }}/artifacts/dpservice-nova-custom-ceph.yml" mode: "0644" - name: Create Ceph-Nova Dataplane Service cifmw.general.ci_script: output_dir: "{{ cifmw_hci_prepare_basedir }}/artifacts" script: "oc apply -f {{ cifmw_hci_prepare_basedir }}/artifacts/dpservice-nova-custom-ceph.yml" - name: Delete OpenStackDataPlaneDeployment cifmw.general.ci_script: output_dir: "{{ cifmw_hci_prepare_basedir }}/artifacts" script: "oc delete OpenStackDataPlaneDeployment --all -n {{ _cifmw_hci_prepare_namespace }}" - name: Create configuration to finish HCI deployment ansible.builtin.copy: mode: "0644" dest: "{{ cifmw_hci_prepare_dataplane_dir }}/87-hci-post-kustomization.yaml" content: |- apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: namespace: {{ _cifmw_hci_prepare_namespace }} patches: - target: kind: OpenStackDataPlaneNodeSet patch: |- - op: add path: /spec/nodeTemplate/extraMounts value: - extraVolType: Ceph volumes: - name: ceph secret: secretName: ceph-conf-files mounts: - name: ceph mountPath: "/etc/ceph" readOnly: true - op: replace path: /spec/services value: {% if cifmw_hci_prepare_enable_repo_setup_service|bool %} - repo-setup {% endif %} - bootstrap - configure-network - validate-network - install-os - ceph-hci-pre - configure-os - ssh-known-hosts - run-os - reboot-os - install-certs - ceph-client - ovn - neutron-metadata - libvirt - nova-custom-ceph {% if cifmw_hci_prepare_extra_services | length > 0 %} {% for svc in cifmw_hci_prepare_extra_services %} - {{ svc }} {% endfor %} {% endif %} - name: Enabled nova discover_hosts after deployment ansible.builtin.set_fact: cifmw_edpm_deploy_skip_nova_discover_hosts: false - name: Save HCI info vars: file_content: cifmw_hci_prepare_ceph_fsid: "{{ cifmw_hci_prepare_ceph_fsid }}" when: not cifmw_hci_prepare_dryrun ansible.builtin.copy: mode: "0644" dest: "{{ cifmw_hci_prepare_basedir }}/artifacts/parameters/hci_prepare_phase2_params.yml" content: "{{ file_content | to_nice_yaml }}"