2015-01-30 20:34:35 +08:00
|
|
|
|
---
|
2017-06-23 18:35:39 +08:00
|
|
|
|
- name: create openstack pool(s)
|
2018-03-06 21:22:48 +08:00
|
|
|
|
command: >
|
2018-03-06 21:26:53 +08:00
|
|
|
|
{{ docker_exec_cmd }} ceph --cluster {{ cluster }}
|
2018-03-06 21:22:48 +08:00
|
|
|
|
osd pool create {{ item.name }}
|
|
|
|
|
{{ item.pg_num }}
|
|
|
|
|
{{ item.pgp_num | default(item.pg_num) }}
|
2018-03-06 21:26:53 +08:00
|
|
|
|
{{ item.rule_name | default("replicated_rule") }}
|
|
|
|
|
{{ item.type | default("replicated") }}
|
|
|
|
|
{%- if item.type | default("replicated") == 'erasure' and item.erasure_profile != '' %}
|
|
|
|
|
{{ item.erasure_profile }}
|
|
|
|
|
{%- endif %}
|
2018-03-26 04:36:27 +08:00
|
|
|
|
{{ item.expected_num_objects | default('') }}
|
2017-01-24 03:53:43 +08:00
|
|
|
|
with_items: "{{ openstack_pools | unique }}"
|
2015-06-26 06:26:03 +08:00
|
|
|
|
changed_when: false
|
2015-01-30 20:34:35 +08:00
|
|
|
|
|
2018-02-09 22:12:35 +08:00
|
|
|
|
- name: assign rbd application to pool(s)
|
|
|
|
|
command: "{{ docker_exec_cmd }} ceph --cluster {{ cluster }} osd pool application enable {{ item.name }} rbd"
|
|
|
|
|
with_items: "{{ openstack_pools | unique }}"
|
|
|
|
|
changed_when: false
|
|
|
|
|
when:
|
|
|
|
|
- ceph_release_num[ceph_release] >= ceph_release_num['luminous']
|
|
|
|
|
|
2018-04-04 22:22:36 +08:00
|
|
|
|
- name: create openstack cephx key(s)
|
|
|
|
|
ceph_key:
|
|
|
|
|
state: present
|
|
|
|
|
name: "{{ item.name }}"
|
|
|
|
|
caps: "{{ item.caps }}"
|
|
|
|
|
secret: "{{ item.key | default('') }}"
|
|
|
|
|
containerized: "{{ docker_exec_cmd | default(False) }}"
|
|
|
|
|
cluster: "{{ cluster }}"
|
2018-04-20 22:37:05 +08:00
|
|
|
|
mode: "{{ item.mode|default(omit) }}"
|
2016-09-21 20:21:41 +08:00
|
|
|
|
with_items: "{{ openstack_keys }}"
|
2016-02-27 05:39:27 +08:00
|
|
|
|
when: cephx
|
2017-06-23 18:35:39 +08:00
|
|
|
|
|
2018-04-04 22:22:36 +08:00
|
|
|
|
- name: fetch openstack cephx key(s)
|
2017-07-19 05:11:55 +08:00
|
|
|
|
fetch:
|
|
|
|
|
src: "/etc/ceph/{{ cluster }}.{{ item.name }}.keyring"
|
|
|
|
|
dest: "{{ fetch_directory }}/{{ fsid }}/etc/ceph/{{ cluster }}.{{ item.name }}.keyring"
|
|
|
|
|
flat: yes
|
|
|
|
|
with_items: "{{ openstack_keys }}"
|
|
|
|
|
|
2018-04-04 22:22:36 +08:00
|
|
|
|
- name: copy to other mons the openstack cephx key(s)
|
2017-07-19 05:11:55 +08:00
|
|
|
|
copy:
|
|
|
|
|
src: "{{ fetch_directory }}/{{ fsid }}/etc/ceph/{{ cluster }}.{{ item.1.name }}.keyring"
|
|
|
|
|
dest: "/etc/ceph/{{ cluster }}.{{ item.1.name }}.keyring"
|
|
|
|
|
with_nested:
|
|
|
|
|
- "{{ groups[mon_group_name] }}"
|
|
|
|
|
- "{{ openstack_keys }}"
|
|
|
|
|
delegate_to: "{{ item.0 }}"
|
|
|
|
|
when:
|
|
|
|
|
- cephx
|
|
|
|
|
- openstack_config
|
2018-04-20 22:37:05 +08:00
|
|
|
|
- item.0 != groups[mon_group_name] | last
|