2020-07-11 05:52:38 +08:00
|
|
|
---
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Gather facts and prepare system for cephadm
|
2020-07-11 05:52:38 +08:00
|
|
|
hosts:
|
|
|
|
- "{{ mon_group_name|default('mons') }}"
|
|
|
|
- "{{ osd_group_name|default('osds') }}"
|
|
|
|
- "{{ mds_group_name|default('mdss') }}"
|
|
|
|
- "{{ rgw_group_name|default('rgws') }}"
|
|
|
|
- "{{ mgr_group_name|default('mgrs') }}"
|
|
|
|
- "{{ rbdmirror_group_name|default('rbdmirrors') }}"
|
2024-06-17 22:35:10 +08:00
|
|
|
- "{{ nfs_group_name|default('nfss') }}"
|
2020-07-25 06:05:41 +08:00
|
|
|
- "{{ monitoring_group_name|default('monitoring') }}"
|
2020-07-11 05:52:38 +08:00
|
|
|
become: true
|
|
|
|
gather_facts: false
|
|
|
|
vars:
|
|
|
|
delegate_facts_host: true
|
|
|
|
tasks:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2020-07-11 05:52:38 +08:00
|
|
|
name: ceph-defaults
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Validate if monitor group doesn't exist or empty
|
|
|
|
ansible.builtin.fail:
|
2020-07-11 05:52:38 +08:00
|
|
|
msg: "you must add a [mons] group and add at least one node."
|
|
|
|
run_once: true
|
|
|
|
when: groups[mon_group_name] is undefined or groups[mon_group_name] | length == 0
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Validate if manager group doesn't exist or empty
|
|
|
|
ansible.builtin.fail:
|
2020-07-11 05:52:38 +08:00
|
|
|
msg: "you must add a [mgrs] group and add at least one node."
|
|
|
|
run_once: true
|
|
|
|
when: groups[mgr_group_name] is undefined or groups[mgr_group_name] | length == 0
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Validate dashboard configuration
|
2020-07-11 05:52:38 +08:00
|
|
|
when: dashboard_enabled | bool
|
|
|
|
run_once: true
|
|
|
|
block:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Fail if [monitoring] group doesn't exist or empty
|
|
|
|
ansible.builtin.fail:
|
2020-07-25 06:05:41 +08:00
|
|
|
msg: "you must add a [monitoring] group and add at least one node."
|
|
|
|
when: groups[monitoring_group_name] is undefined or groups[monitoring_group_name] | length == 0
|
2020-07-11 05:52:38 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Fail when dashboard_admin_password is not set
|
|
|
|
ansible.builtin.fail:
|
2020-07-11 05:52:38 +08:00
|
|
|
msg: "you must set dashboard_admin_password."
|
|
|
|
when: dashboard_admin_password is undefined
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Validate container registry credentials
|
|
|
|
ansible.builtin.fail:
|
2020-07-11 05:52:38 +08:00
|
|
|
msg: 'ceph_docker_registry_username and/or ceph_docker_registry_password variables need to be set'
|
|
|
|
when:
|
|
|
|
- ceph_docker_registry_auth | bool
|
|
|
|
- (ceph_docker_registry_username is not defined or ceph_docker_registry_password is not defined) or
|
|
|
|
(ceph_docker_registry_username | length == 0 or ceph_docker_registry_password | length == 0)
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Gather facts
|
|
|
|
ansible.builtin.setup:
|
2020-07-11 05:52:38 +08:00
|
|
|
gather_subset:
|
|
|
|
- 'all'
|
|
|
|
- '!facter'
|
|
|
|
- '!ohai'
|
|
|
|
when: not delegate_facts_host | bool
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Gather and delegate facts
|
|
|
|
ansible.builtin.setup:
|
2020-07-11 05:52:38 +08:00
|
|
|
gather_subset:
|
|
|
|
- 'all'
|
|
|
|
- '!facter'
|
|
|
|
- '!ohai'
|
|
|
|
delegate_to: "{{ item }}"
|
|
|
|
delegate_facts: true
|
|
|
|
with_items: "{{ groups['all'] }}"
|
|
|
|
run_once: true
|
|
|
|
when: delegate_facts_host | bool
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2020-07-11 05:52:38 +08:00
|
|
|
name: ceph-facts
|
|
|
|
tasks_from: container_binary.yml
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Check if it is atomic host
|
|
|
|
ansible.builtin.stat:
|
2020-07-11 05:52:38 +08:00
|
|
|
path: /run/ostree-booted
|
|
|
|
register: stat_ostree
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set_fact is_atomic
|
|
|
|
ansible.builtin.set_fact:
|
2020-07-11 05:52:38 +08:00
|
|
|
is_atomic: "{{ stat_ostree.stat.exists }}"
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-container-engine role
|
|
|
|
ansible.builtin.import_role:
|
2020-07-11 05:52:38 +08:00
|
|
|
name: ceph-container-engine
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-container-common role
|
|
|
|
ansible.builtin.import_role:
|
2020-07-11 05:52:38 +08:00
|
|
|
name: ceph-container-common
|
|
|
|
tasks_from: registry.yml
|
|
|
|
when: ceph_docker_registry_auth | bool
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Configure repository for installing cephadm
|
2021-09-15 20:53:04 +08:00
|
|
|
vars:
|
|
|
|
ceph_origin: repository
|
|
|
|
ceph_repository: community
|
|
|
|
block:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Validate repository variables
|
|
|
|
ansible.builtin.import_role:
|
2021-09-15 20:53:04 +08:00
|
|
|
name: ceph-validate
|
|
|
|
tasks_from: check_repository.yml
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Configure repository
|
|
|
|
ansible.builtin.import_role:
|
2021-09-15 20:53:04 +08:00
|
|
|
name: ceph-common
|
|
|
|
tasks_from: "configure_repository.yml"
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Install cephadm requirements
|
|
|
|
ansible.builtin.package:
|
2020-07-11 05:52:38 +08:00
|
|
|
name: ['python3', 'lvm2']
|
|
|
|
register: result
|
|
|
|
until: result is succeeded
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Install cephadm
|
|
|
|
ansible.builtin.package:
|
2021-09-15 20:53:04 +08:00
|
|
|
name: cephadm
|
|
|
|
register: result
|
|
|
|
until: result is succeeded
|
2020-07-11 05:52:38 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set_fact cephadm_cmd
|
|
|
|
ansible.builtin.set_fact:
|
2020-07-20 22:41:53 +08:00
|
|
|
cephadm_cmd: "cephadm {{ '--docker' if container_binary == 'docker' else '' }}"
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Bootstrap the cluster
|
2020-07-11 05:52:38 +08:00
|
|
|
hosts: "{{ mon_group_name|default('mons') }}[0]"
|
|
|
|
become: true
|
|
|
|
gather_facts: false
|
|
|
|
tasks:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2020-07-11 05:52:38 +08:00
|
|
|
name: ceph-defaults
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-facts role
|
|
|
|
ansible.builtin.import_role:
|
2020-07-11 05:52:38 +08:00
|
|
|
name: ceph-facts
|
|
|
|
tasks_from: set_monitor_address.yml
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Create /etc/ceph directory
|
|
|
|
ansible.builtin.file:
|
2020-07-11 05:52:38 +08:00
|
|
|
path: /etc/ceph
|
|
|
|
state: directory
|
2024-02-14 18:14:02 +08:00
|
|
|
mode: "0755"
|
2020-07-11 05:52:38 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Bootstrap the new cluster
|
2020-10-16 08:42:00 +08:00
|
|
|
cephadm_bootstrap:
|
2024-02-16 21:20:22 +08:00
|
|
|
mon_ip: "{{ _monitor_addresses[inventory_hostname] }}"
|
2020-10-16 08:42:00 +08:00
|
|
|
image: "{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
|
|
|
|
docker: "{{ true if container_binary == 'docker' else false }}"
|
|
|
|
pull: false
|
|
|
|
dashboard: "{{ dashboard_enabled }}"
|
|
|
|
dashboard_user: "{{ dashboard_admin_user if dashboard_enabled | bool else omit }}"
|
|
|
|
dashboard_password: "{{ dashboard_admin_password if dashboard_enabled | bool else omit }}"
|
|
|
|
monitoring: false
|
|
|
|
firewalld: "{{ configure_firewall }}"
|
2021-10-10 06:52:08 +08:00
|
|
|
ssh_user: "{{ cephadm_ssh_user | default('root') }}"
|
|
|
|
ssh_config: "{{ cephadm_ssh_config | default(omit) }}"
|
2020-07-11 05:52:38 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set default container image in ceph configuration
|
|
|
|
ansible.builtin.command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} config set global container_image {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
|
2020-07-11 05:52:38 +08:00
|
|
|
changed_when: false
|
|
|
|
environment:
|
|
|
|
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set container image base in ceph configuration
|
|
|
|
ansible.builtin.command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} config set mgr mgr/cephadm/container_image_base {{ ceph_docker_registry }}/{{ ceph_docker_image }}"
|
2020-07-11 05:52:38 +08:00
|
|
|
changed_when: false
|
|
|
|
environment:
|
|
|
|
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set dashboard container image in ceph mgr configuration
|
2020-07-11 05:52:38 +08:00
|
|
|
when: dashboard_enabled | bool
|
|
|
|
block:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set alertmanager container image in ceph configuration
|
|
|
|
ansible.builtin.command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} config set mgr mgr/cephadm/container_image_alertmanager {{ alertmanager_container_image }}"
|
2020-07-11 05:52:38 +08:00
|
|
|
changed_when: false
|
|
|
|
environment:
|
|
|
|
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set grafana container image in ceph configuration
|
|
|
|
ansible.builtin.command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} config set mgr mgr/cephadm/container_image_grafana {{ grafana_container_image }}"
|
2020-07-11 05:52:38 +08:00
|
|
|
changed_when: false
|
|
|
|
environment:
|
|
|
|
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set node-exporter container image in ceph configuration
|
|
|
|
ansible.builtin.command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} config set mgr mgr/cephadm/container_image_node_exporter {{ node_exporter_container_image }}"
|
2020-07-11 05:52:38 +08:00
|
|
|
changed_when: false
|
|
|
|
environment:
|
|
|
|
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set prometheus container image in ceph configuration
|
|
|
|
ansible.builtin.command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} config set mgr mgr/cephadm/container_image_prometheus {{ prometheus_container_image }}"
|
2020-07-11 05:52:38 +08:00
|
|
|
changed_when: false
|
|
|
|
environment:
|
|
|
|
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Add the other nodes
|
2020-07-11 05:52:38 +08:00
|
|
|
hosts:
|
|
|
|
- "{{ mon_group_name|default('mons') }}"
|
|
|
|
- "{{ osd_group_name|default('osds') }}"
|
|
|
|
- "{{ mds_group_name|default('mdss') }}"
|
|
|
|
- "{{ rgw_group_name|default('rgws') }}"
|
|
|
|
- "{{ mgr_group_name|default('mgrs') }}"
|
|
|
|
- "{{ rbdmirror_group_name|default('rbdmirrors') }}"
|
2024-06-17 22:35:10 +08:00
|
|
|
- "{{ nfs_group_name|default('nfss') }}"
|
2020-07-25 06:05:41 +08:00
|
|
|
- "{{ monitoring_group_name|default('monitoring') }}"
|
2020-07-11 05:52:38 +08:00
|
|
|
become: true
|
|
|
|
gather_facts: false
|
|
|
|
tasks:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2020-07-11 05:52:38 +08:00
|
|
|
name: ceph-defaults
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Get the cephadm ssh pub key
|
|
|
|
ansible.builtin.command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} cephadm get-pub-key"
|
2020-07-11 05:52:38 +08:00
|
|
|
changed_when: false
|
|
|
|
run_once: true
|
|
|
|
register: cephadm_pubpkey
|
|
|
|
delegate_to: '{{ groups[mon_group_name][0] }}'
|
|
|
|
environment:
|
|
|
|
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Allow cephadm key
|
|
|
|
ansible.posix.authorized_key:
|
2021-09-15 21:02:05 +08:00
|
|
|
user: "{{ cephadm_ssh_user | default('root') }}"
|
2020-07-11 05:52:38 +08:00
|
|
|
key: '{{ cephadm_pubpkey.stdout }}'
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Run cephadm prepare-host
|
|
|
|
ansible.builtin.command: cephadm prepare-host
|
2020-07-11 05:52:38 +08:00
|
|
|
changed_when: false
|
|
|
|
environment:
|
|
|
|
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Manage nodes with cephadm - ipv4
|
|
|
|
ansible.builtin.command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} orch host add {{ ansible_facts['hostname'] }} {{ ansible_facts['all_ipv4_addresses'] | ips_in_ranges(public_network.split(',')) | first }} {{ group_names | join(' ') }} {{ '_admin' if mon_group_name | default('mons') in group_names else '' }}"
|
2020-07-11 05:52:38 +08:00
|
|
|
changed_when: false
|
|
|
|
delegate_to: '{{ groups[mon_group_name][0] }}'
|
|
|
|
environment:
|
|
|
|
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
|
2021-10-28 20:12:46 +08:00
|
|
|
when: ip_version == 'ipv4'
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Manage nodes with cephadm - ipv6
|
|
|
|
ansible.builtin.command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} orch host add {{ ansible_facts['hostname'] }} {{ ansible_facts['all_ipv6_addresses'] | ips_in_ranges(public_network.split(',')) | last | ansible.utils.ipwrap }} {{ group_names | join(' ') }} {{ '_admin' if mon_group_name | default('mons') in group_names else '' }}"
|
2021-10-28 20:12:46 +08:00
|
|
|
changed_when: false
|
|
|
|
delegate_to: '{{ groups[mon_group_name][0] }}'
|
|
|
|
environment:
|
|
|
|
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
|
|
|
|
when: ip_version == 'ipv6'
|
2020-07-11 05:52:38 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Add ceph label for core component
|
|
|
|
ansible.builtin.command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} orch host label add {{ ansible_facts['hostname'] }} ceph"
|
2020-07-11 05:52:38 +08:00
|
|
|
changed_when: false
|
|
|
|
delegate_to: '{{ groups[mon_group_name][0] }}'
|
2020-12-10 06:05:25 +08:00
|
|
|
when: inventory_hostname in groups.get(mon_group_name, []) or
|
|
|
|
inventory_hostname in groups.get(osd_group_name, []) or
|
|
|
|
inventory_hostname in groups.get(mds_group_name, []) or
|
|
|
|
inventory_hostname in groups.get(rgw_group_name, []) or
|
|
|
|
inventory_hostname in groups.get(mgr_group_name, []) or
|
|
|
|
inventory_hostname in groups.get(rbdmirror_group_name, [])
|
2020-07-11 05:52:38 +08:00
|
|
|
environment:
|
|
|
|
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Adjust service placement
|
2020-07-11 05:52:38 +08:00
|
|
|
hosts: "{{ mon_group_name|default('mons') }}[0]"
|
|
|
|
become: true
|
|
|
|
gather_facts: false
|
|
|
|
tasks:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults role
|
|
|
|
ansible.builtin.import_role:
|
2020-07-11 05:52:38 +08:00
|
|
|
name: ceph-defaults
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Update the placement of monitor hosts
|
|
|
|
ansible.builtin.command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} orch apply mon --placement='label:{{ mon_group_name }}'"
|
2020-07-11 05:52:38 +08:00
|
|
|
changed_when: false
|
|
|
|
environment:
|
|
|
|
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Waiting for the monitor to join the quorum...
|
|
|
|
ansible.builtin.command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} quorum_status --format json"
|
2020-07-11 05:52:38 +08:00
|
|
|
changed_when: false
|
|
|
|
register: ceph_health_raw
|
|
|
|
until: (ceph_health_raw.stdout | from_json)["quorum_names"] | length == groups.get(mon_group_name, []) | length
|
|
|
|
retries: "{{ health_mon_check_retries }}"
|
|
|
|
delay: "{{ health_mon_check_delay }}"
|
|
|
|
environment:
|
|
|
|
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Update the placement of manager hosts
|
|
|
|
ansible.builtin.command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} orch apply mgr --placement='label:{{ mgr_group_name }}'"
|
2020-07-11 05:52:38 +08:00
|
|
|
changed_when: false
|
|
|
|
environment:
|
|
|
|
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Update the placement of crash hosts
|
|
|
|
ansible.builtin.command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} orch apply crash --placement='label:ceph'"
|
2020-07-11 05:52:38 +08:00
|
|
|
changed_when: false
|
|
|
|
environment:
|
|
|
|
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
|
|
|
|
|
2024-03-04 09:03:19 +08:00
|
|
|
- name: Update the placement of ceph-exporter hosts
|
|
|
|
ansible.builtin.command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} orch apply ceph-exporter --placement='label:ceph'"
|
|
|
|
changed_when: false
|
|
|
|
environment:
|
|
|
|
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Adjust monitoring service placement
|
2020-07-25 06:05:41 +08:00
|
|
|
hosts: "{{ monitoring_group_name|default('monitoring') }}"
|
2020-07-11 05:52:38 +08:00
|
|
|
become: true
|
|
|
|
gather_facts: false
|
|
|
|
tasks:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults
|
|
|
|
ansible.builtin.import_role:
|
2020-07-11 05:52:38 +08:00
|
|
|
name: ceph-defaults
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: With dashboard enabled
|
2020-07-11 05:52:38 +08:00
|
|
|
when: dashboard_enabled | bool
|
|
|
|
delegate_to: '{{ groups[mon_group_name][0] }}'
|
|
|
|
run_once: true
|
|
|
|
block:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Enable the prometheus module
|
|
|
|
ansible.builtin.command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} mgr module enable prometheus"
|
2020-07-11 05:52:38 +08:00
|
|
|
changed_when: false
|
|
|
|
environment:
|
|
|
|
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Update the placement of alertmanager hosts
|
|
|
|
ansible.builtin.command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} orch apply alertmanager --placement='label:{{ monitoring_group_name }}'"
|
2020-07-11 05:52:38 +08:00
|
|
|
changed_when: false
|
|
|
|
environment:
|
|
|
|
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Update the placement of grafana hosts
|
|
|
|
ansible.builtin.command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} orch apply grafana --placement='label:{{ monitoring_group_name }}'"
|
2020-07-11 05:52:38 +08:00
|
|
|
changed_when: false
|
|
|
|
environment:
|
|
|
|
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Update the placement of prometheus hosts
|
|
|
|
ansible.builtin.command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} orch apply prometheus --placement='label:{{ monitoring_group_name }}'"
|
2020-07-11 05:52:38 +08:00
|
|
|
changed_when: false
|
|
|
|
environment:
|
|
|
|
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Update the placement of node-exporter hosts
|
|
|
|
ansible.builtin.command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} orch apply node-exporter --placement='*'"
|
2020-07-11 05:52:38 +08:00
|
|
|
changed_when: false
|
|
|
|
environment:
|
|
|
|
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Print information
|
2020-07-11 05:52:38 +08:00
|
|
|
hosts: "{{ mon_group_name|default('mons') }}[0]"
|
|
|
|
become: true
|
|
|
|
gather_facts: false
|
|
|
|
tasks:
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Import ceph-defaults
|
|
|
|
ansible.builtin.import_role:
|
2020-07-11 05:52:38 +08:00
|
|
|
name: ceph-defaults
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Show ceph orchestrator services
|
|
|
|
ansible.builtin.command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} orch ls --refresh"
|
2020-07-11 05:52:38 +08:00
|
|
|
changed_when: false
|
|
|
|
environment:
|
|
|
|
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Show ceph orchestrator daemons
|
|
|
|
ansible.builtin.command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} orch ps --refresh"
|
2020-07-11 05:52:38 +08:00
|
|
|
changed_when: false
|
|
|
|
environment:
|
|
|
|
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Inform users about cephadm
|
|
|
|
ansible.builtin.debug:
|
2020-07-11 05:52:38 +08:00
|
|
|
msg: |
|
|
|
|
This Ceph cluster is now ready to receive more configuration like
|
|
|
|
adding OSD, MDS daemons, create pools or keyring.
|
|
|
|
You can do this by using the cephadm CLI and you don't need to use
|
|
|
|
ceph-ansible playbooks anymore.
|