mirror of https://github.com/ceph/ceph-ansible.git
ceph_key: allow setting 'dest' to a file
This is useful in situations where you fetch the key from the mon store and want to write the file with a different name to a dedicated directory. This is important when fetching the mgr key, they are created as mgr.ceph-mon2 but we want them in /var/lib/ceph/mgr/ceph-ceph-mon0/keyring Signed-off-by: Sébastien Han <seb@redhat.com>pull/3375/head
parent
14fc5bad12
commit
23f685b352
|
@ -83,7 +83,7 @@ options:
|
||||||
default: True
|
default: True
|
||||||
dest:
|
dest:
|
||||||
description:
|
description:
|
||||||
- Destination to write the keyring
|
- Destination to write the keyring, can a file or a directory
|
||||||
required: false
|
required: false
|
||||||
default: /etc/ceph/
|
default: /etc/ceph/
|
||||||
fetch_initial_keys:
|
fetch_initial_keys:
|
||||||
|
@ -568,9 +568,13 @@ def run_module():
|
||||||
if not caps:
|
if not caps:
|
||||||
fatal("Capabilities must be provided when state is 'present'", module) # noqa E501
|
fatal("Capabilities must be provided when state is 'present'", module) # noqa E501
|
||||||
|
|
||||||
# Build a different path for bootstrap keys as there are stored as
|
# if dest is not a directory, the user wants to change the file's name
|
||||||
# /var/lib/ceph/bootstrap-rbd/ceph.keyring
|
# (e,g: /etc/ceph/ceph.mgr.ceph-mon2.keyring)
|
||||||
if 'bootstrap' in dest:
|
if not os.path.isdir(dest):
|
||||||
|
file_path = dest
|
||||||
|
elif 'bootstrap' in dest:
|
||||||
|
# Build a different path for bootstrap keys as there are stored as
|
||||||
|
# /var/lib/ceph/bootstrap-rbd/ceph.keyring
|
||||||
file_path = os.path.join(dest + "/" + cluster + ".keyring")
|
file_path = os.path.join(dest + "/" + cluster + ".keyring")
|
||||||
else:
|
else:
|
||||||
file_path = os.path.join(dest + "/" + cluster +
|
file_path = os.path.join(dest + "/" + cluster +
|
||||||
|
|
Loading…
Reference in New Issue