allow deletes from kv v2
@@ -63,6 +63,7 @@ EXAMPLES = '''
def main():
argspec = hashivault_argspec()
argspec['secret'] = dict(required=True, type='str')
+ argspec['version'] = dict(required=False, type='int', default=1)
module = hashivault_init(argspec)
result = hashivault_delete(module.params)
if result.get('failed'):
@@ -78,9 +79,13 @@ from ansible.module_utils.hashivault import *
def hashivault_delete(params):
result = { "changed": False, "rc" : 0}
client = hashivault_auth_client(params)
+ version = params.get('version')
secret = params.get('secret')
if secret.startswith('/'):
secret = secret.lstrip('/')
+
+ if version == 2:
+ secret = (u'secret/data/%s' % secret)
else:
secret = (u'secret/%s' % secret)
with warnings.catch_warnings():
