1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Set protection group enabled by default with option to disable (#28582)

This commit is contained in:
Simon Dodsley 2017-08-24 11:48:01 -04:00 committed by Dag Wieers
parent c850bf15d0
commit 000ccc838a

View file

@ -44,6 +44,11 @@ options:
- Define whether to eradicate the protection group on delete and leave in trash. - Define whether to eradicate the protection group on delete and leave in trash.
type : bool type : bool
default: 'no' default: 'no'
enabled:
description:
- Define whether to enabled snapshots for the protection group.
type : bool
default: 'yes'
extends_documentation_fragment: extends_documentation_fragment:
- purestorage - purestorage
''' '''
@ -55,6 +60,13 @@ EXAMPLES = r'''
fa_url: 10.10.10.2 fa_url: 10.10.10.2
api_token: e31060a7-21fc-e277-6240-25983c6c4592 api_token: e31060a7-21fc-e277-6240-25983c6c4592
- name: Create new protection group with snapshots disabled
purefa_pg:
pgroup: foo
enabled: false
fa_url: 10.10.10.2
api_token: e31060a7-21fc-e277-6240-25983c6c4592
- name: Delete protection group - name: Delete protection group
purefa_pg: purefa_pg:
pgroup: foo pgroup: foo
@ -123,6 +135,7 @@ def make_pgroup(module, array):
if not module.check_mode: if not module.check_mode:
host = array.create_pgroup(module.params['pgroup']) host = array.create_pgroup(module.params['pgroup'])
array.set_pgroup(module.params['pgroup'], snap_enabled=module.params['enabled'])
if module.params['volume']: if module.params['volume']:
array.set_pgroup(module.params['pgroup'], vollist=module.params['volume']) array.set_pgroup(module.params['pgroup'], vollist=module.params['volume'])
if module.params['host']: if module.params['host']:
@ -156,6 +169,7 @@ def main():
host=dict(type='list'), host=dict(type='list'),
hostgroup=dict(type='list'), hostgroup=dict(type='list'),
eradicate=dict(type='bool', default=False), eradicate=dict(type='bool', default=False),
enabled=dict(type='bool', default=True),
)) ))
module = AnsibleModule(argument_spec, supports_check_mode=True) module = AnsibleModule(argument_spec, supports_check_mode=True)