mirror of https://github.com/ceph/ceph-ansible.git
77 lines
2.5 KiB
YAML
77 lines
2.5 KiB
YAML
---
|
||
- name: create openstack pool(s)
|
||
command: >
|
||
{{ docker_exec_cmd }} ceph --cluster {{ cluster }}
|
||
osd pool create {{ item.name }}
|
||
{{ item.pg_num }}
|
||
{{ item.pgp_num | default(item.pg_num) }}
|
||
{{ item.rule_name | default("replicated_rule") }}
|
||
{{ item.type | default("replicated") }}
|
||
{%- if item.type | default("replicated") == 'erasure' and item.erasure_profile != '' %}
|
||
{{ item.erasure_profile }}
|
||
{%- endif %}
|
||
{{ item.expected_num_objects | default('') }}
|
||
with_items: "{{ openstack_pools | unique }}"
|
||
changed_when: false
|
||
|
||
- 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']
|
||
|
||
- 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 }}"
|
||
with_items: "{{ openstack_keys }}"
|
||
when: cephx
|
||
|
||
- name: fetch openstack cephx key(s)
|
||
fetch:
|
||
src: "/etc/ceph/{{ cluster }}.{{ item.name }}.keyring"
|
||
dest: "{{ fetch_directory }}/{{ fsid }}/etc/ceph/{{ cluster }}.{{ item.name }}.keyring"
|
||
flat: yes
|
||
with_items: "{{ openstack_keys }}"
|
||
|
||
- name: copy to other mons the openstack cephx key(s)
|
||
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
|
||
- item.0 != groups[mon_group_name] | last
|
||
|
||
- name: chmod openstack cephx key(s) on the other mons and this mon
|
||
file:
|
||
path: "/etc/ceph/{{ cluster }}.{{ item.1.name }}.keyring"
|
||
mode: "{{ item.1.mode|default(omit) }}" # if mode not in list, uses mode from ps umask
|
||
with_nested:
|
||
- "{{ groups[mon_group_name] }}"
|
||
- "{{ openstack_keys }}"
|
||
delegate_to: "{{ item.0 }}"
|
||
when:
|
||
- openstack_config
|
||
- cephx
|
||
|
||
- name: setfacl for openstack cephx key(s) on the other mons and this mon
|
||
command: "setfacl -m {{ item.1.acls | join(',') }} /etc/ceph/{{ cluster }}.{{ item.1.name }}.keyring"
|
||
with_nested:
|
||
- "{{ groups[mon_group_name] }}"
|
||
- "{{ openstack_keys }}"
|
||
delegate_to: "{{ item.0 }}"
|
||
when:
|
||
- item.1.get('acls', []) | length > 0
|
||
- openstack_config
|
||
- cephx
|