ceph-ansible/roles/ceph-fetch-keys/tasks/main.yml

34 lines
918 B
YAML

---
- name: find ceph keys
shell: ls -1 /etc/ceph/*.keyring
changed_when: false
register: ceph_keys
always_run: true
- name: set keys permissions
file:
path: "{{ item }}"
mode: 0600
owner: root
group: root
with_items:
- "{{ ceph_keys.stdout_lines }}"
- name: register rbd bootstrap key
set_fact:
bootstrap_rbd_keyring: "/var/lib/ceph/bootstrap-rbd/{{ cluster }}.keyring"
when: ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous
- name: copy keys to the ansible server
fetch:
src: "{{ item }}"
dest: "{{ fetch_directory }}/{{ fsid }}/{{ item }}"
flat: yes
run_once: true
with_items:
- "{{ ceph_keys.stdout_lines }}"
- "/var/lib/ceph/bootstrap-osd/{{ cluster }}.keyring"
- "/var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring"
- "/var/lib/ceph/bootstrap-mds/{{ cluster }}.keyring"
- "{{ bootstrap_rbd_keyring | default([]) }}"