2018-04-11 23:15:29 +08:00
|
|
|
---
|
2019-09-23 19:30:05 +08:00
|
|
|
- name: get keys from monitors
|
|
|
|
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} auth get {{ item.name }}"
|
|
|
|
register: _rbd_mirror_keys
|
|
|
|
with_items:
|
|
|
|
- { name: "client.bootstrap-rbd-mirror", path: "/var/lib/ceph/bootstrap-rbd-mirror/{{ cluster }}.keyring", copy_key: true }
|
|
|
|
- { name: "client.admin", path: "/etc/ceph/{{ cluster }}.client.admin.keyring", copy_key: "{{ copy_admin_key }}" }
|
|
|
|
delegate_to: "{{ groups.get(mon_group_name)[0] }}"
|
2019-10-02 15:57:50 +08:00
|
|
|
run_once: true
|
2019-09-23 19:30:05 +08:00
|
|
|
when:
|
|
|
|
- cephx | bool
|
|
|
|
- item.copy_key | bool
|
2018-12-10 22:30:48 +08:00
|
|
|
|
2019-09-23 19:30:05 +08:00
|
|
|
- name: copy ceph key(s) if needed
|
2019-09-10 02:33:55 +08:00
|
|
|
copy:
|
2019-09-23 19:30:05 +08:00
|
|
|
dest: "{{ item.item.path }}"
|
|
|
|
content: "{{ item.stdout + '\n' }}"
|
2019-09-10 02:33:55 +08:00
|
|
|
owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
|
|
|
|
group: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
|
|
|
|
mode: "{{ ceph_keyring_permissions }}"
|
2019-09-23 19:30:05 +08:00
|
|
|
with_items: "{{ _rbd_mirror_keys.results }}"
|
|
|
|
when:
|
|
|
|
- cephx | bool
|
|
|
|
- item.item.copy_key | bool
|
2019-09-10 02:33:55 +08:00
|
|
|
|
2018-12-10 22:30:48 +08:00
|
|
|
- name: create rbd-mirror keyring
|
|
|
|
command: >
|
|
|
|
ceph --cluster {{ cluster }}
|
|
|
|
--name client.bootstrap-rbd-mirror
|
|
|
|
--keyring /var/lib/ceph/bootstrap-rbd-mirror/{{ cluster }}.keyring
|
|
|
|
auth get-or-create client.rbd-mirror.{{ ansible_hostname }}
|
|
|
|
mon 'profile rbd-mirror'
|
|
|
|
osd 'profile rbd'
|
|
|
|
-o /etc/ceph/{{ cluster }}.client.rbd-mirror.{{ ansible_hostname }}.keyring
|
|
|
|
args:
|
|
|
|
creates: /etc/ceph/{{ cluster }}.client.rbd-mirror.{{ ansible_hostname }}.keyring
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|
2018-12-10 22:30:48 +08:00
|
|
|
|
|
|
|
- name: set rbd-mirror key permissions
|
|
|
|
file:
|
|
|
|
path: /etc/ceph/{{ cluster }}.client.rbd-mirror.{{ ansible_hostname }}.keyring
|
|
|
|
owner: "ceph"
|
|
|
|
group: "ceph"
|
|
|
|
mode: "{{ ceph_keyring_permissions }}"
|
2019-05-22 16:02:42 +08:00
|
|
|
when: not containerized_deployment | bool
|