If 'absent' is used, the module will simply delete the keyring.
If 'list' is used, the module will list all the keys and will
return a json output.
- If 'update' is used, the module will **only** update the capabilities
- of a given keyring.
+ If 'update' is used, the module will **only** update
+ the capabilities of a given keyring.
If 'info' is used, the module will return in a json format the
description of a given keyring.
required: true
osd: allow *
mgr: allow *
mds: allow
+ mode: 0400
import_key: False
- name: create monitor initial keyring
raise(Exception(message))
-def key_mode(file_path, mode):
- '''
- Change mode file for a CephX key
- Problem, how to do this on containerized deployment?
- '''
- os.chmod(file_path, mode)
-
-
def generate_secret():
'''
Generate a CephX secret
'''
for k, v in caps.iteritems():
- # makes sure someone didn't pass an empty var, we don't want to add an empty cap
+ # makes sure someone didn't pass an empty var,
+ # we don't want to add an empty cap
if len(k) == 0:
continue
if _type == "ceph-authtool":
module = AnsibleModule(
argument_spec=module_args,
- supports_check_mode=True
+ supports_check_mode=True,
+ add_file_common_args=True,
)
# Gather module parameters in variables
if not caps:
fatal("Capabilities must be provided when state is 'present'", module)
- # We allow 'present' to override any existing key ONLY if a secret is provided, if not we skip the creation
+ # We allow 'present' to override any existing key
+ # ONLY if a secret is provided
+ # if not we skip the creation
if import_key:
if rc == 0 and not secret:
result["stdout"] = "skipped, since {0} already exists, if you want to update a key use 'state: update'".format(
rc, cmd, out, err = exec_commands(module, create_key(
module, result, cluster, name, secret, caps, import_key, auid, dest, containerized))
+ file_path = os.path.join(
+ dest + "/" + cluster + "." + name + ".keyring")
+ file_args = module.load_file_common_arguments(module.params)
+ file_args['path'] = file_path
+ module.set_fs_attributes_if_different(file_args, False)
elif state == "update":
if not caps:
fatal("Capabilities must be provided when state is 'update'", module)