From 0dcacdbed09ef78350c03112021cae885ff47ba9 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Tue, 10 Dec 2019 15:57:42 +0100 Subject: [PATCH] ceph_volume: add destroy option support The zap action from ceph_volume module always implies `--destroy`. This commit adds the destroy option support so we can ask ceph-volume to not use `--destroy` when zapping a device. Signed-off-by: Guillaume Abrioux --- library/ceph_volume.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/ceph_volume.py b/library/ceph_volume.py index 8398a876a..3c9161d8a 100644 --- a/library/ceph_volume.py +++ b/library/ceph_volume.py @@ -461,11 +461,13 @@ def zap_devices(module, container_image): wal = module.params.get('wal', None) wal_vg = module.params.get('wal_vg', None) osd_fsid = module.params.get('osd_fsid', None) + destroy = module.params.get('destroy', True) # build the CLI action = ['lvm', 'zap'] cmd = build_ceph_volume_cmd(action, container_image) - cmd.append('--destroy') + if destroy: + cmd.append('--destroy') if osd_fsid: cmd.extend(['--osd-fsid', osd_fsid]) @@ -516,6 +518,7 @@ def run_module(): report=dict(type='bool', required=False, default=False), containerized=dict(type='str', required=False, default=False), osd_fsid=dict(type='str', required=False), + destroy=dict(type='bool', required=False, default=True), ) module = AnsibleModule(