2018-03-23 11:24:56 +08:00
|
|
|
---
|
|
|
|
- name: make sure gateway_ip_list is configured
|
|
|
|
fail:
|
|
|
|
msg: "you must set a list of IPs (comma separated) for gateway_ip_list"
|
2019-04-01 23:46:15 +08:00
|
|
|
when: gateway_ip_list == "0.0.0.0"
|
2018-03-23 11:24:56 +08:00
|
|
|
|
|
|
|
- name: copy admin key
|
|
|
|
copy:
|
|
|
|
src: "{{ fetch_directory }}/{{ fsid }}/etc/ceph/{{ cluster }}.client.admin.keyring"
|
|
|
|
dest: "/etc/ceph/{{ cluster }}.client.admin.keyring"
|
|
|
|
owner: "root"
|
|
|
|
group: "root"
|
2018-06-25 21:12:56 +08:00
|
|
|
mode: "{{ ceph_keyring_permissions }}"
|
2019-04-01 23:46:15 +08:00
|
|
|
when: cephx
|
2018-03-23 11:24:56 +08:00
|
|
|
|
|
|
|
- name: deploy gateway settings, used by the ceph_iscsi_config modules
|
|
|
|
template:
|
|
|
|
src: "{{ role_path }}/templates/iscsi-gateway.cfg.j2"
|
|
|
|
dest: /etc/ceph/iscsi-gateway.cfg
|
|
|
|
|
2019-05-14 20:51:32 +08:00
|
|
|
- name: set_fact container_exec_cmd
|
2018-03-23 11:24:56 +08:00
|
|
|
set_fact:
|
2019-05-14 20:51:32 +08:00
|
|
|
container_exec_cmd: "{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }}"
|
2018-03-23 11:24:56 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
when: containerized_deployment
|
|
|
|
|
|
|
|
- name: check if a rbd pool exists
|
2019-05-14 20:51:32 +08:00
|
|
|
command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd pool ls --format json"
|
2018-03-23 11:24:56 +08:00
|
|
|
changed_when: false
|
|
|
|
register: rbd_pool_exists
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
|
2018-10-01 23:11:13 +08:00
|
|
|
- name: rbd pool related tasks
|
2018-03-23 11:24:56 +08:00
|
|
|
when: "'rbd' not in (rbd_pool_exists.stdout | from_json)"
|
2018-10-01 23:11:13 +08:00
|
|
|
block:
|
|
|
|
- name: create a rbd pool if it doesn't exist
|
2019-05-14 20:51:32 +08:00
|
|
|
command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd pool create rbd {{ osd_pool_default_pg_num }}"
|
2018-10-01 23:11:13 +08:00
|
|
|
changed_when: false
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
|
|
|
|
- name: customize pool size
|
2019-05-14 20:51:32 +08:00
|
|
|
command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} osd pool set rbd size {{ rbd_pool_size | default(osd_pool_default_size) }}"
|
2018-10-01 23:11:13 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
changed_when: false
|
2019-04-01 23:46:15 +08:00
|
|
|
when: rbd_pool_size | default(osd_pool_default_size) != ceph_osd_pool_default_size
|