--- # Defines deployment design and assigns role to server groups - hosts: localhost connection: local tasks: - name: Warn about ceph-ansible current status fail: msg: "cephadm is the new official installer. Please, consider migrating. See https://docs.ceph.com/en/latest/cephadm/install for new deployments or https://docs.ceph.com/en/latest/cephadm/adoption for migrating existing deployments." when: not yes_i_know | default(false) | bool - hosts: - mons - osds - mdss - rgws - nfss - rbdmirrors - clients - iscsigws - mgrs - monitoring gather_facts: false become: True any_errors_fatal: true vars: delegate_facts_host: True pre_tasks: - import_tasks: raw_install_python.yml tasks: # pre-tasks for following import - - import_role: name: ceph-defaults - name: gather facts setup: gather_subset: - 'all' - '!facter' - '!ohai' when: not delegate_facts_host | bool or inventory_hostname in groups.get(client_group_name, []) tags: always - name: gather and delegate facts setup: gather_subset: - 'all' - '!facter' - '!ohai' delegate_to: "{{ item }}" delegate_facts: True with_items: "{{ groups['all'] | difference(groups.get('clients', [])) }}" run_once: true when: delegate_facts_host | bool tags: always # dummy container setup is only supported on x86_64 # when running with containerized_deployment: true this task # creates a group that contains only x86_64 hosts. # when running with containerized_deployment: false this task # will add all client hosts to the group (and not filter). - name: create filtered clients group add_host: name: "{{ item }}" groups: _filtered_clients with_items: "{{ groups.get(client_group_name, []) | intersect(ansible_play_batch) }}" when: (hostvars[item]['ansible_facts']['architecture'] == 'x86_64') or (not containerized_deployment | bool) tags: [with_pkg, fetch_container_image] - import_role: name: ceph-facts - import_role: name: ceph-validate - import_role: name: ceph-infra - import_role: name: ceph-handler - import_role: name: ceph-container-engine tags: with_pkg when: (group_names != ['clients'] and group_names != ['clients', '_filtered_clients'] and group_names != ['_filtered_clients', 'clients']) or (inventory_hostname == groups.get('_filtered_clients', [''])|first) - import_role: name: ceph-container-common tags: fetch_container_image when: (group_names != ['clients'] and group_names != ['clients', '_filtered_clients'] and group_names != ['_filtered_clients', 'clients']) or (inventory_hostname == groups.get('_filtered_clients', [''])|first) - hosts: mons gather_facts: false any_errors_fatal: true tasks: - name: set ceph monitor install 'In Progress' run_once: true set_stats: data: installer_phase_ceph_mon: status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - hosts: mons become: True gather_facts: false any_errors_fatal: true tasks: - import_role: name: ceph-defaults tags: ['ceph_update_config'] - import_role: name: ceph-facts tags: ['ceph_update_config'] - import_role: name: ceph-handler tags: ['ceph_update_config'] - import_role: name: ceph-config tags: ['ceph_update_config'] - import_role: name: ceph-mon - import_role: name: ceph-mgr when: groups.get(mgr_group_name, []) | length == 0 - hosts: mons gather_facts: false any_errors_fatal: true tasks: - name: set ceph monitor install 'Complete' run_once: true set_stats: data: installer_phase_ceph_mon: status: "Complete" end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - hosts: mgrs become: True gather_facts: false any_errors_fatal: true tasks: # pre-tasks for following imports - - name: set ceph manager install 'In Progress' run_once: true set_stats: data: installer_phase_ceph_mgr: status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - import_role: name: ceph-defaults tags: ['ceph_update_config'] - import_role: name: ceph-facts tags: ['ceph_update_config'] - import_role: name: ceph-handler tags: ['ceph_update_config'] - import_role: name: ceph-config tags: ['ceph_update_config'] - import_role: name: ceph-mgr # post-tasks for upcoming imports - - name: set ceph manager install 'Complete' run_once: true set_stats: data: installer_phase_ceph_mgr: status: "Complete" end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - hosts: mons[0] become: True gather_facts: false any_errors_fatal: true tasks: - import_role: name: ceph-defaults - name: set global config ceph_config: action: set who: "global" option: "{{ item.key }}" value: "{{ item.value }}" environment: CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" with_dict: "{{ { 'public_network': public_network | default(False), 'cluster_network': cluster_network | default(False), 'osd pool default crush rule': osd_pool_default_crush_rule, 'ms bind ipv6': 'true' if ip_version == 'ipv6' else 'false', 'ms bind ipv4': 'false' if ip_version == 'ipv6' else 'true', 'osd crush chooseleaf type': '0' if common_single_host_mode | default(False) | bool else False, } }}" when: - inventory_hostname == ansible_play_hosts_all | last - item.value - name: set global config overrides ceph_config: action: set who: "global" option: "{{ item.key }}" value: "{{ item.value }}" environment: CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" when: inventory_hostname == ansible_play_hosts_all | last with_dict: "{{ ceph_conf_overrides['global'] }}" - name: set osd_memory_target ceph_config: action: set who: "osd.*/{{ item }}:host" option: "osd_memory_target" value: "{{ _osd_memory_target | default(osd_memory_target) }}" environment: CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" when: inventory_hostname == ansible_play_hosts_all | last loop: "{{ groups[osd_group_name] | default([]) }}" - hosts: osds become: True gather_facts: false any_errors_fatal: true tasks: # pre-tasks for upcoming imports - - name: set ceph osd install 'In Progress' run_once: true set_stats: data: installer_phase_ceph_osd: status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - import_role: name: ceph-defaults tags: ['ceph_update_config'] - import_role: name: ceph-facts tags: ['ceph_update_config'] - import_role: name: ceph-handler tags: ['ceph_update_config'] - import_role: name: ceph-config tags: ['ceph_update_config'] - import_role: name: ceph-osd # post-tasks for preceding imports - - name: set ceph osd install 'Complete' run_once: true set_stats: data: installer_phase_ceph_osd: status: "Complete" end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - hosts: mdss become: True gather_facts: false any_errors_fatal: true tasks: # pre-tasks for following imports - - name: set ceph mds install 'In Progress' run_once: true set_stats: data: installer_phase_ceph_mds: status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - import_role: name: ceph-defaults tags: ['ceph_update_config'] - import_role: name: ceph-facts tags: ['ceph_update_config'] - import_role: name: ceph-handler tags: ['ceph_update_config'] - import_role: name: ceph-config tags: ['ceph_update_config'] - import_role: name: ceph-mds # post-tasks for preceding imports - - name: set ceph mds install 'Complete' run_once: true set_stats: data: installer_phase_ceph_mds: status: "Complete" end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - hosts: rgws become: True gather_facts: false any_errors_fatal: true tasks: # pre-tasks for following imports - - name: set ceph rgw install 'In Progress' run_once: true set_stats: data: installer_phase_ceph_rgw: status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - import_role: name: ceph-defaults tags: ['ceph_update_config'] - import_role: name: ceph-facts tags: ['ceph_update_config'] - import_role: name: ceph-handler tags: ['ceph_update_config'] - import_role: name: ceph-config tags: ['ceph_update_config'] - import_role: name: ceph-rgw # post-tasks for preceding imports - - name: set ceph rgw install 'Complete' run_once: true set_stats: data: installer_phase_ceph_rgw: status: "Complete" end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - hosts: clients become: True gather_facts: false any_errors_fatal: true tags: 'ceph_client' tasks: # pre-tasks for following imports - - name: set ceph client install 'In Progress' run_once: true set_stats: data: installer_phase_ceph_client: status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - import_role: name: ceph-defaults tags: ['ceph_update_config'] - import_role: name: ceph-facts tags: ['ceph_update_config'] - import_role: name: ceph-handler tags: ['ceph_update_config'] - import_role: name: ceph-config tags: ['ceph_update_config'] - import_role: name: ceph-client # post-tasks for preceding imports - - name: set ceph client install 'Complete' run_once: true set_stats: data: installer_phase_ceph_client: status: "Complete" end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - hosts: nfss become: True gather_facts: false any_errors_fatal: true tasks: # pre-tasks for following imports - - name: set ceph nfs install 'In Progress' run_once: true set_stats: data: installer_phase_ceph_nfs: status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - import_role: name: ceph-defaults tags: ['ceph_update_config'] - import_role: name: ceph-facts tags: ['ceph_update_config'] - import_role: name: ceph-handler tags: ['ceph_update_config'] - import_role: name: ceph-config tags: ['ceph_update_config'] - import_role: name: ceph-nfs # post-tasks for following imports - - name: set ceph nfs install 'Complete' run_once: true set_stats: data: installer_phase_ceph_nfs: status: "Complete" end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - hosts: rbdmirrors become: True gather_facts: false any_errors_fatal: true tasks: # pre-tasks for following imports - - name: set ceph rbd mirror install 'In Progress' run_once: true set_stats: data: installer_phase_ceph_rbdmirror: status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - import_role: name: ceph-defaults tags: ['ceph_update_config'] - import_role: name: ceph-facts tags: ['ceph_update_config'] - import_role: name: ceph-handler tags: ['ceph_update_config'] - import_role: name: ceph-config tags: ['ceph_update_config'] - import_role: name: ceph-rbd-mirror # post-tasks for preceding imports - - name: set ceph rbd mirror install 'Complete' run_once: true set_stats: data: installer_phase_ceph_rbdmirror: status: "Complete" end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - hosts: - iscsigws gather_facts: false any_errors_fatal: true become: True tasks: # pre-tasks for following imports - - name: set ceph iscsi gateway install 'In Progress' run_once: true set_stats: data: installer_phase_ceph_iscsi_gw: status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - import_role: name: ceph-defaults tags: ['ceph_update_config'] - import_role: name: ceph-facts tags: ['ceph_update_config'] - import_role: name: ceph-handler tags: ['ceph_update_config'] - import_role: name: ceph-config tags: ['ceph_update_config'] - import_role: name: ceph-iscsi-gw # post-tasks for preceding imports - post_tasks: - name: set ceph iscsi gw install 'Complete' run_once: true set_stats: data: installer_phase_ceph_iscsi_gw: status: "Complete" end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - import_playbook: dashboard.yml when: - dashboard_enabled | bool - groups.get(monitoring_group_name, []) | length > 0 - hosts: - mons - osds - mdss - rgws - rbdmirrors - mgrs gather_facts: false become: True any_errors_fatal: true pre_tasks: - name: set ceph crash install 'In Progress' run_once: true set_stats: data: installer_phase_ceph_crash: status: "In Progress" start: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" tasks: - import_role: name: ceph-defaults - import_role: name: ceph-facts tasks_from: container_binary.yml - import_role: name: ceph-handler - import_role: name: ceph-crash post_tasks: - name: set ceph crash install 'Complete' run_once: true set_stats: data: installer_phase_ceph_crash: status: "Complete" end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" - hosts: mons[0] gather_facts: false become: True any_errors_fatal: true tasks: - import_role: name: ceph-defaults - name: check if podman binary is present stat: path: /usr/bin/podman register: podman_binary - name: set_fact container_binary set_fact: container_binary: "{{ 'podman' if (podman_binary.stat.exists and ansible_facts['distribution'] == 'Fedora') or (ansible_facts['os_family'] == 'RedHat' and ansible_facts['distribution_major_version'] in ['8', '9']) else 'docker' }}" - name: get ceph status from the first monitor command: > {{ container_binary }} exec ceph-mon-{{ hostvars[inventory_hostname]['ansible_facts']['hostname'] }} ceph --cluster {{ cluster }} -s register: ceph_status changed_when: false - name: "show ceph status for cluster {{ cluster }}" debug: msg: "{{ ceph_status.stdout_lines }}" when: not ceph_status.failed