mirror of https://github.com/ceph/ceph-ansible.git
ceph-mds: group similar tasks in create_mds_filesystem.yml
Group similar tasks together using block keyword.
Signed-off-by: Rishabh Dave <ridave@redhat.com>
(cherry picked from commit 1a4dccdbb9
)
pull/3970/head
parent
238a2696a6
commit
8959ed50a5
|
@ -1,11 +1,13 @@
|
||||||
---
|
---
|
||||||
|
- name: check and deploy filesystem pools
|
||||||
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
||||||
|
block:
|
||||||
|
- name: check if filesystem pool already exists
|
||||||
|
block:
|
||||||
- name: compile a list of pool names
|
- name: compile a list of pool names
|
||||||
set_fact:
|
set_fact:
|
||||||
cephfs_pool_names: "{{ cephfs_pools | map(attribute='name') | list }}"
|
cephfs_pool_names: "{{ cephfs_pools | map(attribute='name') | list }}"
|
||||||
|
|
||||||
- name: check if filesystem pool already exists
|
|
||||||
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
||||||
block:
|
|
||||||
- name: get and store list of filesystem pools
|
- name: get and store list of filesystem pools
|
||||||
command: "{{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd pool ls"
|
command: "{{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd pool ls"
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
@ -18,11 +20,10 @@
|
||||||
|
|
||||||
- name: deploy filesystem pools
|
- name: deploy filesystem pools
|
||||||
when: fs_pools_created is not defined
|
when: fs_pools_created is not defined
|
||||||
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
||||||
block:
|
block:
|
||||||
- name: create filesystem pools
|
- name: create filesystem pools
|
||||||
command: >
|
command: >
|
||||||
{{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }}
|
{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }}
|
||||||
osd pool create {{ item.name }}
|
osd pool create {{ item.name }}
|
||||||
{{ item.pg_num | default(item.pgs) | default(osd_pool_default_pg_num) }}
|
{{ item.pg_num | default(item.pgs) | default(osd_pool_default_pg_num) }}
|
||||||
{{ item.pgp_num | default(item.pgs) | default(item.pg_num) | default(osd_pool_default_pg_num) }}
|
{{ item.pgp_num | default(item.pgs) | default(item.pg_num) | default(osd_pool_default_pg_num) }}
|
||||||
|
@ -48,26 +49,25 @@
|
||||||
changed_when: false
|
changed_when: false
|
||||||
when: (item.min_size | default(osd_pool_default_min_size))|int > ceph_osd_pool_default_min_size
|
when: (item.min_size | default(osd_pool_default_min_size))|int > ceph_osd_pool_default_min_size
|
||||||
|
|
||||||
- name: check if ceph filesystem already exists
|
|
||||||
command: "{{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} fs get {{ cephfs }}"
|
|
||||||
register: check_existing_cephfs
|
|
||||||
changed_when: false
|
|
||||||
failed_when: false
|
|
||||||
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
||||||
|
|
||||||
- name: create ceph filesystem
|
|
||||||
command: "{{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} fs new {{ cephfs }} {{ cephfs_metadata }} {{ cephfs_data }}"
|
|
||||||
changed_when: false
|
|
||||||
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
||||||
when: check_existing_cephfs.rc != 0
|
|
||||||
|
|
||||||
- name: assign application to cephfs pools
|
- name: assign application to cephfs pools
|
||||||
command: "{{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd pool application enable {{ item }} cephfs"
|
command: "{{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd pool application enable {{ item }} cephfs"
|
||||||
with_items:
|
with_items:
|
||||||
- "{{ cephfs_data }}"
|
- "{{ cephfs_data }}"
|
||||||
- "{{ cephfs_metadata }}"
|
- "{{ cephfs_metadata }}"
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
|
- name: check and create ceph filesystem
|
||||||
delegate_to: "{{ groups[mon_group_name][0] }}"
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
||||||
|
block:
|
||||||
|
- name: check if ceph filesystem already exists
|
||||||
|
command: "{{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} fs get {{ cephfs }}"
|
||||||
|
register: check_existing_cephfs
|
||||||
|
changed_when: false
|
||||||
|
failed_when: false
|
||||||
|
|
||||||
|
- name: create ceph filesystem
|
||||||
|
command: "{{ docker_exec_cmd | default('') }} ceph --cluster {{ cluster }} fs new {{ cephfs }} {{ cephfs_metadata }} {{ cephfs_data }}"
|
||||||
|
changed_when: false
|
||||||
when: check_existing_cephfs.rc != 0
|
when: check_existing_cephfs.rc != 0
|
||||||
|
|
||||||
- name: set max_mds
|
- name: set max_mds
|
||||||
|
|
Loading…
Reference in New Issue