ceph: add ceph_config
add module that allows to manage ceph configuration
Sem-Ver: feature
Change-Id: Ic188c470758c0a173514b8d3279da0291661fb78
diff --git a/plugins/modules/ceph_config.py b/plugins/modules/ceph_config.py
new file mode 100644
index 0000000..0c7a183
--- /dev/null
+++ b/plugins/modules/ceph_config.py
@@ -0,0 +1,43 @@
+#!/usr/bin/python3
+
+from ansible.module_utils.basic import AnsibleModule
+
+def run_module():
+ module_args = dict(
+ who=dict(type='str', required=True),
+ name=dict(type='str', required=True),
+ value=dict(type='str', required=True),
+ )
+
+ module = AnsibleModule(
+ argument_spec=module_args,
+ supports_check_mode=True
+ )
+
+ who = module.params['who']
+ name = module.params['name']
+ value = module.params['value']
+
+ changed = False
+
+ _, out, _ = module.run_command(
+ ['ceph', 'config', 'get', who, name], check_rc=True
+ )
+
+ if out.strip() != value:
+ changed = True
+
+ if not module.check_mode:
+ _, _, _ = module.run_command(
+ ['ceph', 'config', 'set', who, name, value], check_rc=True
+ )
+
+ module.exit_json(changed=changed)
+
+
+def main():
+ run_module()
+
+
+if __name__ == '__main__':
+ main()
\ No newline at end of file
diff --git a/releasenotes/notes/add-ceph-config-module-2390d050b6b0d976.yaml b/releasenotes/notes/add-ceph-config-module-2390d050b6b0d976.yaml
new file mode 100644
index 0000000..49bcaaa
--- /dev/null
+++ b/releasenotes/notes/add-ceph-config-module-2390d050b6b0d976.yaml
@@ -0,0 +1,3 @@
+---
+features:
+ - Added ``ceph_config`` module to allow tweaking Ceph configuration via IaC.