--- # 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: Deploy ceph for 17.1 deployment hosts: "{{ cifmw_target_host | default('localhost') }}" tasks: - name: Gather ansible_user_dir from undercloud delegate_to: "osp-undercloud-0" ansible.builtin.setup: gather_subset: - user_dir - name: Deploy 17.1 ceph vars: _cifmw_basedir_undercloud: >- {{ [ansible_user_dir, 'ci-framework-data' ] | path_join }} stack: >- {{ cifmw_adoption_osp_deploy_scenario.stacks[stack_index | int] }} _overcloud_name: >- {{ stack.stackname }} _roles_file: >- {{ [cifmw_adoption_source_scenario_path, stack.roles_file ] | path_join }} _roles_file_dest: >- {{ [ansible_user_dir, 'roles_' ~ _overcloud_name ~ '.yaml' ] | path_join }} _network_data_file_dest: >- {{ [ansible_user_dir, 'network_data_' ~ _overcloud_name ~ '.yaml' ] | path_join }} _ceph_osd_spec_file: >- {{ [cifmw_adoption_source_scenario_path, stack.ceph_osd_spec_file ] | path_join }} _ceph_osd_spec_file_name: "{{ _ceph_osd_spec_file | basename }}" _ceph_osd_spec_file_dest: >- {{ [ansible_user_dir, _ceph_osd_spec_file_name ] | path_join }} _cloud_domain: "{{ cifmw_adoption_osp_deploy_scenario.cloud_domain }}" _source_cmd: "source {{ ansible_user_dir }}/stackrc" # Use stack-specific filename for non-default stack names to avoid overwrites # Default 'overcloud' stack uses 'deployed_ceph.yaml' for backward compatibility _deployed_ceph_suffix: "{{ '' if _overcloud_name == 'overcloud' else '_' ~ _overcloud_name }}" _deployed_ceph_file: "{{ ansible_user_dir }}/deployed_ceph{{ _deployed_ceph_suffix }}.yaml" block: - name: Copy ceph osd file delegate_to: "osp-undercloud-0" ansible.builtin.copy: src: "{{ _ceph_osd_spec_file }}" dest: "{{ _ceph_osd_spec_file_dest }}" mode: "0644" - name: Copy roles file delegate_to: "osp-undercloud-0" ansible.builtin.copy: src: "{{ _roles_file }}" dest: "{{ _roles_file_dest }}" mode: "0644" - name: Ensure ceph_spec file does not exist delegate_to: "osp-undercloud-0" ansible.builtin.file: path: "{{ ansible_user_dir }}/ceph_spec.yaml" state: absent - name: Generate ceph_spec file delegate_to: "osp-undercloud-0" vars: _ceph_spec_cmd: >- openstack overcloud ceph spec {{ ansible_user_dir }}/config_download_{{ _overcloud_name }}.yaml --stack {{ _overcloud_name }} --tld {{ _cloud_domain }} --osd-spec {{ _ceph_osd_spec_file_dest }} --roles-data {{ _roles_file_dest }} -o {{ansible_user_dir}}/ceph_spec.yaml cifmw.general.ci_script: chdir: "{{ ansible_user_dir }}" output_dir: "{{ _cifmw_basedir_undercloud }}/artifacts" script: "{{ _source_cmd }}; {{ _ceph_spec_cmd }}" - name: Ensure deployed_ceph file does not exist delegate_to: "osp-undercloud-0" ansible.builtin.file: path: "{{ _deployed_ceph_file }}" state: absent - name: Gather nodes for stack {{ _overcloud_name }} when: group.key is in _hostname_map_translation vars: _hostname_map_translation: >- {{ cifmw_adoption_osp_deploy_scenario.hostname_groups_map | ansible.utils.keep_keys(target=stack.stack_nodes) }} ansible.builtin.set_fact: _tripleo_nodes: >- {{ _tripleo_nodes | default([]) + group.value }} loop: "{{ _vm_groups | dict2items }}" loop_control: loop_var: group label: "{{ group.key }}" - name: Install packages needed for ceph deployment on the overcloud nodes become: true delegate_to: "{{ item }}" ansible.builtin.dnf: name: - lvm2 - jq state: present loop: "{{ _tripleo_nodes }}" # NOTE: TripleO has the hardcoded --yes-i-know option that is not valid anymore # in RHCS 7. TripleO does not receive any new patch both upstream and downstream # (it is a retired project), hence the only option we have is to patch the # current code to not have that line. - name: Patch Ceph bootstrap task become: true delegate_to: "osp-undercloud-0" ansible.builtin.lineinfile: path: "/usr/share/ansible/roles/tripleo_cephadm/tasks/bootstrap.yaml" state: absent regexp: '--yes-i-know' backup: true - name: Deploy ceph delegate_to: "osp-undercloud-0" vars: # Only pass --cluster for non-default stacks to set unique cluster names # Default 'overcloud' stack uses 'ceph' cluster name for backward compatibility _ceph_deploy_cmd: >- openstack overcloud ceph deploy --stack {{ _overcloud_name }} {%- if _overcloud_name != 'overcloud' %} --cluster {{ _overcloud_name }}{% endif %} --tld {{ _cloud_domain }} --ntp-server {{ cifmw_adoption_osp_deploy_ntp_server }} --ceph-spec ceph_spec.yaml --network-data {{ _network_data_file_dest }} --container-image-prepare {{ ansible_user_dir }}/containers-prepare-parameters.yaml --output {{ _deployed_ceph_file }} cifmw.general.ci_script: chdir: "{{ ansible_user_dir }}" output_dir: "{{ _cifmw_basedir_undercloud }}/artifacts" script: "{{ _source_cmd }}; {{ _ceph_deploy_cmd }}"