mirror of https://github.com/ceph/ceph-ansible.git
146 lines
3.6 KiB
YAML
146 lines
3.6 KiB
YAML
---
|
|
# This playbook is used to add a new OSD to
|
|
# an existing cluster without the need for running
|
|
# the ceph-container-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
|
|
become: true
|
|
|
|
vars:
|
|
delegate_facts_host: True
|
|
|
|
pre_tasks:
|
|
- import_tasks: "{{ playbook_dir }}/../raw_install_python.yml"
|
|
|
|
- name: gather facts
|
|
setup:
|
|
gather_subset:
|
|
- 'all'
|
|
- '!facter'
|
|
- '!ohai'
|
|
when: not delegate_facts_host | bool
|
|
|
|
- import_role:
|
|
name: ceph-defaults
|
|
|
|
- name: gather and delegate facts
|
|
setup:
|
|
gather_subset:
|
|
- 'all'
|
|
- '!facter'
|
|
- '!ohai'
|
|
delegate_to: "{{ item }}"
|
|
delegate_facts: True
|
|
with_items:
|
|
- "{{ groups[mon_group_name] }}"
|
|
- "{{ groups[osd_group_name] }}"
|
|
run_once: True
|
|
when: delegate_facts_host | bool
|
|
|
|
tasks:
|
|
- import_role:
|
|
name: ceph-facts
|
|
|
|
- import_role:
|
|
name: ceph-validate
|
|
|
|
- hosts: osds
|
|
gather_facts: False
|
|
become: True
|
|
|
|
vars:
|
|
delegate_facts_host: True
|
|
|
|
pre_tasks:
|
|
|
|
- name: gather facts
|
|
setup:
|
|
gather_subset:
|
|
- 'all'
|
|
- '!facter'
|
|
- '!ohai'
|
|
when: not delegate_facts_host | bool
|
|
|
|
- import_role:
|
|
name: ceph-defaults
|
|
|
|
- name: gather and delegate facts
|
|
setup:
|
|
gather_subset:
|
|
- 'all'
|
|
- '!facter'
|
|
- '!ohai'
|
|
delegate_to: "{{ item }}"
|
|
delegate_facts: True
|
|
with_items:
|
|
- "{{ groups[mon_group_name] }}"
|
|
- "{{ groups[osd_group_name] }}"
|
|
run_once: True
|
|
when: delegate_facts_host | bool
|
|
|
|
- import_role:
|
|
name: ceph-facts
|
|
- import_role:
|
|
name: ceph-handler
|
|
- import_role:
|
|
name: ceph-infra
|
|
- import_role:
|
|
name: ceph-container-engine
|
|
when: containerized_deployment | bool
|
|
- import_role:
|
|
name: ceph-container-common
|
|
when: containerized_deployment | bool
|
|
- import_role:
|
|
name: ceph-common
|
|
when: not containerized_deployment | bool
|
|
|
|
# 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: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd set noup"
|
|
delegate_to: "{{ groups['mons'][0] }}"
|
|
run_once: True
|
|
changed_when: False
|
|
|
|
tasks:
|
|
- import_role:
|
|
name: ceph-facts
|
|
- import_role:
|
|
name: ceph-handler
|
|
- import_role:
|
|
name: ceph-config
|
|
- import_role:
|
|
name: ceph-osd
|
|
|
|
post_tasks:
|
|
- name: unset noup flag
|
|
command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd unset noup"
|
|
delegate_to: "{{ groups['mons'][0] }}"
|
|
run_once: True
|
|
changed_when: False
|
|
|
|
- name: warn user about deprecation
|
|
debug:
|
|
msg: |
|
|
Playbook has complete.
|
|
However, note that it will be deprecated in a future release.
|
|
You can achieve the same goal using the main playbook with --limit |