kolla-ansible/ansible/roles/ceph_pools.yml
Mark Goddard a11d376389 Use become for all docker tasks
Many tasks that use Docker have become specified already, but
not all. This change ensures all tasks that use the following
modules have become:

* kolla_docker
* kolla_ceph_keyring
* kolla_toolbox
* kolla_container_facts

It also adds become for 'command' tasks that use docker CLI.

Change-Id: I4a5ebcedaccb9261dbc958ec67e8077d7980e496
(cherry picked from commit b123bf6621)
2019-06-28 11:26:57 +01:00

118 lines
3.8 KiB
YAML

---
# TODO(SamYaple): Improve failed_when and changed_when tests if possible
- name: Creating ceph erasure profile
become: true
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
become: true
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
become: true
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
become: true
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
delegate_to: "{{ groups['ceph-mon'][0] }}"
changed_when: False
run_once: True
- name: enable application for ceph pool
become: true
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
- name: Creating ceph ruleset for cache
become: true
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
when: ceph_enable_cache | bool
- name: Creating ceph pool for cache
become: true
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
when: ceph_enable_cache | bool
- name: Adding cache to pool
become: true
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
when: ceph_enable_cache | bool
- name: Setting cache-mode
become: true
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
when: ceph_enable_cache | bool
- name: Setting cache overlay for pool
become: true
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
when: ceph_enable_cache | bool
- name: Setting cache hit_set_type
become: true
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
when: ceph_enable_cache | bool
- name: Setting cache target_max_bytes
become: true
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:
- ceph_enable_cache | bool
- ceph_target_max_bytes != ''
- name: Setting cache target_max_objects
become: true
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:
- ceph_enable_cache | bool
- ceph_target_max_objects != ''