2018-09-27 22:31:22 +08:00
|
|
|
---
|
|
|
|
# This playbook is used to add a new OSD to
|
|
|
|
# an existing cluster without the need for running
|
|
|
|
# the ceph-docker-common or ceph-common and ceph-mon role again against all
|
|
|
|
# of the existing monitors.
|
|
|
|
#
|
|
|
|
# It can run from any machine. Even if the fetch directory is not present
|
|
|
|
# it will be created.
|
|
|
|
#
|
|
|
|
# Ensure that all monitors are present in the mons
|
|
|
|
# group in your inventory so that the ceph configuration file
|
|
|
|
# is created correctly for the new OSD(s).
|
|
|
|
#
|
|
|
|
# It is expected to edit your inventory file to only point to the OSD hosts
|
|
|
|
# you want to play the playbook on. So you need to comment already deployed OSD
|
|
|
|
# and let uncommented the new OSDs.
|
|
|
|
#
|
|
|
|
- hosts:
|
|
|
|
- mons
|
|
|
|
- osds
|
|
|
|
|
|
|
|
gather_facts: False
|
|
|
|
|
|
|
|
vars:
|
|
|
|
delegate_facts_host: True
|
|
|
|
|
2018-10-01 23:43:24 +08:00
|
|
|
tasks:
|
|
|
|
# pre-tasks for following import
|
2018-09-27 22:31:22 +08:00
|
|
|
- name: gather facts
|
|
|
|
setup:
|
|
|
|
when:
|
|
|
|
- not delegate_facts_host | bool
|
|
|
|
|
|
|
|
- name: gather and delegate facts
|
|
|
|
setup:
|
|
|
|
delegate_to: "{{ item }}"
|
|
|
|
delegate_facts: True
|
|
|
|
with_items:
|
|
|
|
- "{{ groups['mons'] }}"
|
|
|
|
- "{{ groups['osds'] }}"
|
|
|
|
run_once: True
|
|
|
|
when:
|
|
|
|
- delegate_facts_host | bool
|
|
|
|
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
private: false
|
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-validate
|
|
|
|
private: false
|
2018-09-27 22:31:22 +08:00
|
|
|
|
|
|
|
- hosts: osds
|
|
|
|
gather_facts: False
|
|
|
|
become: True
|
|
|
|
|
2018-10-01 23:43:24 +08:00
|
|
|
tasks:
|
|
|
|
# pre-tasks for following import
|
2018-09-27 22:31:22 +08:00
|
|
|
# this task is needed so we can skip the openstack_config.yml include in roles/ceph-osd
|
|
|
|
- name: set_fact add_osd
|
|
|
|
set_fact:
|
|
|
|
add_osd: True
|
|
|
|
|
|
|
|
- name: set noup flag
|
|
|
|
command: "{{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd set noup"
|
|
|
|
delegate_to: "{{ groups['mons'][0] }}"
|
|
|
|
run_once: True
|
|
|
|
changed_when: False
|
|
|
|
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-defaults
|
|
|
|
private: false
|
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-handler
|
|
|
|
private: false
|
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-infra
|
|
|
|
private: false
|
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-docker-common
|
|
|
|
private: false
|
2018-09-27 22:31:22 +08:00
|
|
|
when: containerized_deployment | bool
|
2018-10-01 23:43:24 +08:00
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-common
|
|
|
|
private: false
|
2018-09-27 22:31:22 +08:00
|
|
|
when: not containerized_deployment | bool
|
|
|
|
|
2018-10-01 23:43:24 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-config
|
|
|
|
private: false
|
|
|
|
|
|
|
|
- import_role:
|
|
|
|
name: ceph-osd
|
|
|
|
private: false
|
|
|
|
|
|
|
|
# post-tasks for preceding import
|
2018-09-27 22:31:22 +08:00
|
|
|
- name: unset noup flag
|
|
|
|
command: "{{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd unset noup"
|
|
|
|
delegate_to: "{{ groups['mons'][0] }}"
|
|
|
|
run_once: True
|
2018-10-01 23:43:24 +08:00
|
|
|
changed_when: False
|