|
| 1 | +--- |
| 2 | +# Copyright Red Hat, Inc. |
| 3 | +# All Rights Reserved. |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 6 | +# not use this file except in compliance with the License. You may obtain |
| 7 | +# a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 13 | +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 14 | +# License for the specific language governing permissions and limitations |
| 15 | +# under the License. |
| 16 | + |
| 17 | +# We are scaling out and the ceph cluster already exists we can directly create the Nodeset utilizing the existing |
| 18 | +# "pre-ceph" values and then update it with "post-ceph" values which include additional ceph configuration and then |
| 19 | +# create and apply Deployment CR with full list of dataplane services. |
| 20 | +- name: Create a values.yaml.j2 file with full list of dataplane services |
| 21 | + ansible.builtin.copy: |
| 22 | + dest: "{{ ci_dcn_site_cifmw_repo_path }}/roles/ci_dcn_site/templates/deployment/values.yaml.j2" |
| 23 | + mode: '0644' |
| 24 | + content: | |
| 25 | + --- |
| 26 | + # source: dcn/deployment/values.yaml.j2 |
| 27 | + apiVersion: v1 |
| 28 | + kind: ConfigMap |
| 29 | + metadata: |
| 30 | + name: edpm-deployment-values-post-ceph |
| 31 | + annotations: |
| 32 | + config.kubernetes.io/local-config: "true" |
| 33 | + data: |
| 34 | + nodeset_name: "{% raw %}{{ _group_name }}{% endraw %}-edpm" |
| 35 | + deployment: |
| 36 | + name: "add-node-{% raw %}{{ _group_name }}{% endraw %}" |
| 37 | + servicesOverride: |
| 38 | + - bootstrap |
| 39 | + - configure-network |
| 40 | + - validate-network |
| 41 | + - install-os |
| 42 | + - ceph-hci-pre |
| 43 | + - configure-os |
| 44 | + - ssh-known-hosts |
| 45 | + - run-os |
| 46 | + - reboot-os |
| 47 | + - install-certs |
| 48 | + - ceph-client |
| 49 | + - ovn |
| 50 | + - "neutron-metadata-cell{% raw %}{{ _all_azs.index(_az) +1 }}{% endraw %}" |
| 51 | + - libvirt |
| 52 | + - nova-custom-ceph-{% raw %}{{ _az }}{% endraw %} |
| 53 | +
|
| 54 | +- name: Initialize vars |
| 55 | + ansible.builtin.set_fact: |
| 56 | + _ceph_vars_list: [] |
| 57 | + _all_azs: [] |
| 58 | + |
| 59 | +- name: Find all ceph .conf and .keyring files |
| 60 | + register: _ceph_conf_files |
| 61 | + ansible.builtin.find: |
| 62 | + paths: "/tmp" |
| 63 | + patterns: "ceph*.conf,ceph*.keyring,az*.conf,az*.keyring" |
| 64 | + recurse: false |
| 65 | + |
| 66 | +- name: Load ceph configuration files |
| 67 | + ansible.builtin.set_fact: |
| 68 | + _ceph_files: "{{ _ceph_conf_files.files | map(attribute='path') | list }}" |
| 69 | + |
| 70 | +- name: Render the NodeSet values.yaml |
| 71 | + vars: |
| 72 | + _edpm_instance_dict: "{{ cifmw_networking_env_definition.instances }}" |
| 73 | + _edpm_network_dict: "{{ cifmw_networking_env_definition.networks }}" |
| 74 | + _ssh_authorizedkeys: "{{ lookup('file', '~/.ssh/id_cifw.pub', rstrip=False) }}" |
| 75 | + _ssh_private_key: "{{ lookup('file', '~/.ssh/id_cifw', rstrip=False) }}" |
| 76 | + _ssh_public_key: "{{ lookup('file', '~/.ssh/id_cifw.pub', rstrip=False) }}" |
| 77 | + _migration_priv_key: "{{ lookup('file', '~/ci-framework-data/artifacts/nova_migration_key', rstrip=False) }}" |
| 78 | + _migration_pub_key: "{{ lookup('file', '~/ci-framework-data/artifacts/nova_migration_key.pub', rstrip=False) }}" |
| 79 | + ansible.builtin.template: |
| 80 | + backup: true |
| 81 | + src: "templates/edpm-pre-ceph/nodeset/values.yaml.j2" |
| 82 | + dest: "{{ ci_dcn_site_arch_path }}/edpm-pre-ceph/nodeset/values.yaml" |
| 83 | + mode: "0644" |
| 84 | + |
| 85 | +- name: Kustomize NodeSet |
| 86 | + ansible.builtin.set_fact: |
| 87 | + nodeset_cr: >- |
| 88 | + {{ lookup('kubernetes.core.kustomize', |
| 89 | + dir=ci_dcn_site_arch_path + '/edpm-pre-ceph/nodeset') }} |
| 90 | +
|
| 91 | +- name: Save the NodeSet CR |
| 92 | + ansible.builtin.copy: |
| 93 | + mode: "0644" |
| 94 | + dest: "{{ ci_dcn_site_arch_path }}/dataplane-nodeset-pre-ceph_{{ _az }}.yaml" |
| 95 | + content: "{{ nodeset_cr }}" |
| 96 | + backup: true |
| 97 | + |
| 98 | +- name: Render the values with updated ceph configuration, kustomize and apply CR of NodeSet and DataPlaneDeployment |
| 99 | + ansible.builtin.import_tasks: post-ceph.yml |
| 100 | + |
| 101 | +- name: Set Network related facts |
| 102 | + ansible.builtin.include_tasks: set_network_facts.yml |
| 103 | + |
| 104 | +- name: Deploy Ceph in DCN context |
| 105 | + ansible.builtin.include_tasks: ceph.yml |
| 106 | + |
| 107 | +- name: Run Nova cell discovery for new DCN hosts |
| 108 | + kubernetes.core.k8s_exec: |
| 109 | + api_key: "{{ _auth_results.openshift_auth.api_key }}" |
| 110 | + namespace: openstack |
| 111 | + pod: nova-cell0-conductor-0 |
| 112 | + command: nova-manage cell_v2 discover_hosts --verbose |
| 113 | + |
| 114 | +- name: Add new hosts to AZ |
| 115 | + ansible.builtin.include_tasks: az.yml |
0 commit comments