--- - name: generate monitor initial keyring local_action: shell python2 -c "import os ; import struct ; import time; import base64 ; key = os.urandom(16) ; header = struct.pack('= ceph_release_num.luminous set_fact: ceph_authtool_cap: "--cap mon 'allow *' --cap osd 'allow *' --cap mds 'allow' --cap mgr 'allow *'" when: - ceph_release_num[ceph_release] >= ceph_release_num.luminous - cephx - admin_secret != 'admin_secret' - name: set_fact ceph_authtool_cap < ceph_release_num.luminous set_fact: ceph_authtool_cap: "--cap mon 'allow *' --cap osd 'allow *' --cap mds 'allow'" when: - ceph_release_num[ceph_release] < ceph_release_num.luminous - cephx - admin_secret != 'admin_secret' - name: create custom admin keyring command: "ceph-authtool /etc/ceph/{{ cluster }}.client.admin.keyring --create-keyring --name=client.admin --add-key={{ admin_secret }} --set-uid=0 {{ ceph_authtool_cap }}" args: creates: /etc/ceph/{{ cluster }}.client.admin.keyring register: create_custom_admin_secret when: - cephx - admin_secret != 'admin_secret' - name: set ownership of admin keyring file: path: /etc/ceph/{{ cluster }}.client.admin.keyring state: file owner: 'ceph' group: 'ceph' mode: '0600' when: - cephx - admin_secret != 'admin_secret' - name: import admin keyring into mon keyring command: ceph-authtool /var/lib/ceph/tmp/keyring.mon.{{ monitor_name }} --import-keyring /etc/ceph/{{ cluster }}.client.admin.keyring when: - not create_custom_admin_secret.get('skipped') - cephx - admin_secret != 'admin_secret' - name: ceph monitor mkfs with keyring command: ceph-mon --cluster {{ cluster }} --setuser ceph --setgroup ceph --mkfs -i {{ monitor_name }} --fsid {{ fsid }} --keyring /var/lib/ceph/tmp/keyring.mon.{{ monitor_name }} args: creates: /var/lib/ceph/mon/{{ cluster }}-{{ monitor_name }}/keyring when: - cephx - name: ceph monitor mkfs without keyring command: ceph-mon --cluster {{ cluster }} --setuser ceph --setgroup ceph --mkfs -i {{ monitor_name }} --fsid {{ fsid }} args: creates: /var/lib/ceph/mon/{{ cluster }}-{{ monitor_name }}/store.db when: - not cephx