2015-10-18 20:34:17 +00:00
|
|
|
---
|
|
|
|
# TODO(SamYaple): Improve failed_when and changed_when tests if possible
|
|
|
|
- name: Creating ceph erasure profile
|
2019-04-09 11:59:02 +00:00
|
|
|
become: true
|
2015-10-18 20:34:17 +00:00
|
|
|
command: docker exec ceph_mon ceph osd erasure-code-profile set erasure-profile {{ ceph_erasure_profile }}
|
|
|
|
delegate_to: "{{ groups['ceph-mon'][0] }}"
|
|
|
|
changed_when: False
|
|
|
|
failed_when: False
|
|
|
|
run_once: True
|
|
|
|
when: pool_type == "erasure"
|
|
|
|
|
|
|
|
- name: Creating ceph ruleset
|
2019-04-09 11:59:02 +00:00
|
|
|
become: true
|
2015-10-18 20:34:17 +00:00
|
|
|
command: docker exec ceph_mon ceph osd crush rule create-erasure disks erasure-profile
|
|
|
|
delegate_to: "{{ groups['ceph-mon'][0] }}"
|
|
|
|
changed_when: False
|
|
|
|
failed_when: False
|
|
|
|
run_once: True
|
|
|
|
when: pool_type == "erasure"
|
|
|
|
|
|
|
|
- name: Creating ceph ruleset
|
2019-04-09 11:59:02 +00:00
|
|
|
become: true
|
2015-10-18 20:34:17 +00:00
|
|
|
command: docker exec ceph_mon ceph osd crush rule create-simple disks {{ ceph_rule }}
|
|
|
|
delegate_to: "{{ groups['ceph-mon'][0] }}"
|
|
|
|
changed_when: False
|
|
|
|
failed_when: False
|
|
|
|
run_once: True
|
|
|
|
when: pool_type == "replicated"
|
|
|
|
|
|
|
|
- name: Creating ceph pool
|
2019-04-09 11:59:02 +00:00
|
|
|
become: true
|
2017-09-15 23:24:43 +08:00
|
|
|
command: docker exec ceph_mon ceph osd pool create {{ pool_name }} {{ pool_pg_num }} {{ pool_pgp_num }} {{ pool_type }} {{ 'erasure-profile' if pool_type == 'erasure' else '' }} disks
|
2015-10-18 20:34:17 +00:00
|
|
|
delegate_to: "{{ groups['ceph-mon'][0] }}"
|
|
|
|
changed_when: False
|
|
|
|
run_once: True
|
|
|
|
|
2018-03-22 15:11:27 +08:00
|
|
|
- name: enable application for ceph pool
|
2019-04-09 11:59:02 +00:00
|
|
|
become: true
|
2018-03-22 15:11:27 +08:00
|
|
|
command: docker exec ceph_mon ceph osd pool application enable {{ pool_name }} {{ pool_application }}
|
|
|
|
changed_when: False
|
|
|
|
delegate_to: "{{ groups['ceph-mon'][0] }}"
|
|
|
|
run_once: True
|
|
|
|
|
2015-10-18 20:34:17 +00:00
|
|
|
- name: Creating ceph ruleset for cache
|
2019-04-09 11:59:02 +00:00
|
|
|
become: true
|
2015-10-18 20:34:17 +00:00
|
|
|
command: docker exec ceph_mon ceph osd crush rule create-simple cache {{ ceph_cache_rule }}
|
|
|
|
delegate_to: "{{ groups['ceph-mon'][0] }}"
|
|
|
|
changed_when: False
|
|
|
|
failed_when: False
|
|
|
|
run_once: True
|
2017-05-09 20:57:23 +08:00
|
|
|
when: ceph_enable_cache | bool
|
2015-10-18 20:34:17 +00:00
|
|
|
|
|
|
|
- name: Creating ceph pool for cache
|
2019-04-09 11:59:02 +00:00
|
|
|
become: true
|
2015-10-18 20:34:17 +00:00
|
|
|
command: docker exec ceph_mon ceph osd pool create {{ pool_name }}-cache 128 128 replicated cache
|
|
|
|
delegate_to: "{{ groups['ceph-mon'][0] }}"
|
|
|
|
changed_when: False
|
|
|
|
run_once: True
|
2017-05-09 20:57:23 +08:00
|
|
|
when: ceph_enable_cache | bool
|
2015-10-18 20:34:17 +00:00
|
|
|
|
|
|
|
- name: Adding cache to pool
|
2019-04-09 11:59:02 +00:00
|
|
|
become: true
|
2015-10-18 20:34:17 +00:00
|
|
|
command: docker exec ceph_mon ceph osd tier add {{ pool_name }} {{ pool_name }}-cache
|
|
|
|
delegate_to: "{{ groups['ceph-mon'][0] }}"
|
|
|
|
changed_when: False
|
|
|
|
failed_when: False
|
|
|
|
run_once: True
|
2017-05-09 20:57:23 +08:00
|
|
|
when: ceph_enable_cache | bool
|
2015-10-18 20:34:17 +00:00
|
|
|
|
|
|
|
- name: Setting cache-mode
|
2019-04-09 11:59:02 +00:00
|
|
|
become: true
|
2015-10-18 20:34:17 +00:00
|
|
|
command: docker exec ceph_mon ceph osd tier cache-mode {{ pool_name }}-cache {{ cache_mode }}
|
|
|
|
delegate_to: "{{ groups['ceph-mon'][0] }}"
|
|
|
|
changed_when: False
|
|
|
|
failed_when: False
|
|
|
|
run_once: True
|
2017-05-09 20:57:23 +08:00
|
|
|
when: ceph_enable_cache | bool
|
2015-10-18 20:34:17 +00:00
|
|
|
|
|
|
|
- name: Setting cache overlay for pool
|
2019-04-09 11:59:02 +00:00
|
|
|
become: true
|
2015-10-18 20:34:17 +00:00
|
|
|
command: docker exec ceph_mon ceph osd tier set-overlay {{ pool_name }} {{ pool_name }}-cache
|
|
|
|
delegate_to: "{{ groups['ceph-mon'][0] }}"
|
|
|
|
changed_when: False
|
|
|
|
failed_when: False
|
|
|
|
run_once: True
|
2017-05-09 20:57:23 +08:00
|
|
|
when: ceph_enable_cache | bool
|
2015-10-18 20:34:17 +00:00
|
|
|
|
|
|
|
- name: Setting cache hit_set_type
|
2019-04-09 11:59:02 +00:00
|
|
|
become: true
|
2015-10-18 20:34:17 +00:00
|
|
|
command: docker exec ceph_mon ceph osd pool set {{ pool_name }}-cache hit_set_type bloom
|
|
|
|
delegate_to: "{{ groups['ceph-mon'][0] }}"
|
|
|
|
changed_when: False
|
|
|
|
failed_when: False
|
|
|
|
run_once: True
|
2017-05-09 20:57:23 +08:00
|
|
|
when: ceph_enable_cache | bool
|
2017-04-01 18:00:23 +08:00
|
|
|
|
|
|
|
- name: Setting cache target_max_bytes
|
2019-04-09 11:59:02 +00:00
|
|
|
become: true
|
2017-04-01 18:00:23 +08:00
|
|
|
command: docker exec ceph_mon ceph osd pool set {{ pool_name }}-cache target_max_bytes {{ ceph_target_max_bytes }}
|
|
|
|
delegate_to: "{{ groups['ceph-mon'][0] }}"
|
|
|
|
changed_when: False
|
|
|
|
failed_when: False
|
|
|
|
run_once: True
|
|
|
|
when:
|
2017-05-09 20:57:23 +08:00
|
|
|
- ceph_enable_cache | bool
|
|
|
|
- ceph_target_max_bytes != ''
|
2017-04-01 18:00:23 +08:00
|
|
|
|
|
|
|
- name: Setting cache target_max_objects
|
2019-04-09 11:59:02 +00:00
|
|
|
become: true
|
2017-04-01 18:00:23 +08:00
|
|
|
command: docker exec ceph_mon ceph osd pool set {{ pool_name }}-cache target_max_objects {{ ceph_target_max_objects }}
|
|
|
|
delegate_to: "{{ groups['ceph-mon'][0] }}"
|
|
|
|
changed_when: False
|
|
|
|
failed_when: False
|
|
|
|
run_once: True
|
|
|
|
when:
|
2017-05-09 20:57:23 +08:00
|
|
|
- ceph_enable_cache | bool
|
|
|
|
- ceph_target_max_objects != ''
|