New preserve_node parameter to skip unreferenced node removal
This commit is contained in:
parent
773d402eac
commit
0405c54dba
1 changed files with 15 additions and 3 deletions
|
@ -114,6 +114,13 @@ options:
|
||||||
- Pool member ratio weight. Valid values range from 1 through 100. New pool members -- unless overriden with this value -- default to 1.
|
- Pool member ratio weight. Valid values range from 1 through 100. New pool members -- unless overriden with this value -- default to 1.
|
||||||
required: false
|
required: false
|
||||||
default: null
|
default: null
|
||||||
|
preserve_node:
|
||||||
|
description:
|
||||||
|
- When state is absent and the pool member is no longer referenced in other pools, the default behavior removes the unused node object. Setting this to 'yes' disables this behavior.
|
||||||
|
required: false
|
||||||
|
default: 'no'
|
||||||
|
choices: ['yes', 'no']
|
||||||
|
version_added: 2.1
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
|
@ -317,7 +324,8 @@ def main():
|
||||||
connection_limit = dict(type='int'),
|
connection_limit = dict(type='int'),
|
||||||
description = dict(type='str'),
|
description = dict(type='str'),
|
||||||
rate_limit = dict(type='int'),
|
rate_limit = dict(type='int'),
|
||||||
ratio = dict(type='int')
|
ratio = dict(type='int'),
|
||||||
|
preserve_node = dict(type='bool', default=False)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -337,6 +345,7 @@ def main():
|
||||||
host = module.params['host']
|
host = module.params['host']
|
||||||
address = fq_name(partition, host)
|
address = fq_name(partition, host)
|
||||||
port = module.params['port']
|
port = module.params['port']
|
||||||
|
preserve_node = module.params['preserve_node']
|
||||||
|
|
||||||
|
|
||||||
# sanity check user supplied values
|
# sanity check user supplied values
|
||||||
|
@ -357,8 +366,11 @@ def main():
|
||||||
if member_exists(api, pool, address, port):
|
if member_exists(api, pool, address, port):
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
remove_pool_member(api, pool, address, port)
|
remove_pool_member(api, pool, address, port)
|
||||||
deleted = delete_node_address(api, address)
|
if preserve_node:
|
||||||
result = {'changed': True, 'deleted': deleted}
|
result = {'changed': True}
|
||||||
|
else:
|
||||||
|
deleted = delete_node_address(api, address)
|
||||||
|
result = {'changed': True, 'deleted': deleted}
|
||||||
else:
|
else:
|
||||||
result = {'changed': True}
|
result = {'changed': True}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue