mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 04:11:25 -07:00
zfs: PEP8 compliancy and documentation changes (#32648)
This PR includes: - PEP8 compliancy changes - Documentation changes
This commit is contained in:
parent
c93ddf5473
commit
10bfa89f06
2 changed files with 32 additions and 37 deletions
|
@ -1,83 +1,78 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2013, Johan Wiren <johan.wiren.se@gmail.com>
|
# Copyright: (c) 2013, Johan Wiren <johan.wiren.se@gmail.com>
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: zfs
|
module: zfs
|
||||||
short_description: Manage zfs
|
short_description: Manage zfs
|
||||||
description:
|
description:
|
||||||
- Manages ZFS file systems, volumes, clones and snapshots.
|
- Manages ZFS file systems, volumes, clones and snapshots
|
||||||
version_added: "1.1"
|
version_added: "1.1"
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- File system, snapshot or volume name e.g. C(rpool/myfs)
|
- File system, snapshot or volume name e.g. C(rpool/myfs).
|
||||||
required: true
|
required: true
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- Whether to create (C(present)), or remove (C(absent)) a
|
- Whether to create (C(present)), or remove (C(absent)) a
|
||||||
file system, snapshot or volume. All parents/children
|
file system, snapshot or volume. All parents/children
|
||||||
will be created/destroyed as needed to reach the desired state.
|
will be created/destroyed as needed to reach the desired state.
|
||||||
choices: ['present', 'absent']
|
choices: [ absent, present ]
|
||||||
required: true
|
required: true
|
||||||
origin:
|
origin:
|
||||||
description:
|
description:
|
||||||
- Snapshot from which to create a clone
|
- Snapshot from which to create a clone.
|
||||||
default: null
|
|
||||||
required: false
|
|
||||||
key_value:
|
key_value:
|
||||||
description:
|
description:
|
||||||
- The C(zfs) module takes key=value pairs for zfs properties to be set. See the zfs(8) man page for more information.
|
- The C(zfs) module takes key=value pairs for zfs properties to be set.
|
||||||
default: null
|
- See the zfs(8) man page for more information.
|
||||||
required: false
|
author:
|
||||||
|
- Johan Wiren (@johanwiren)
|
||||||
author: "Johan Wiren (@johanwiren)"
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Create a new file system called myfs in pool rpool with the setuid property turned off
|
- name: Create a new file system called myfs in pool rpool with the setuid property turned off
|
||||||
- zfs:
|
zfs:
|
||||||
name: rpool/myfs
|
name: rpool/myfs
|
||||||
state: present
|
state: present
|
||||||
setuid: off
|
setuid: off
|
||||||
|
|
||||||
# Create a new volume called myvol in pool rpool.
|
- name: Create a new volume called myvol in pool rpool.
|
||||||
- zfs:
|
zfs:
|
||||||
name: rpool/myvol
|
name: rpool/myvol
|
||||||
state: present
|
state: present
|
||||||
volsize: 10M
|
volsize: 10M
|
||||||
|
|
||||||
# Create a snapshot of rpool/myfs file system.
|
- name: Create a snapshot of rpool/myfs file system.
|
||||||
- zfs:
|
zfs:
|
||||||
name: rpool/myfs@mysnapshot
|
name: rpool/myfs@mysnapshot
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
# Create a new file system called myfs2 with snapdir enabled
|
- name: Create a new file system called myfs2 with snapdir enabled
|
||||||
- zfs:
|
zfs:
|
||||||
name: rpool/myfs2
|
name: rpool/myfs2
|
||||||
state: present
|
state: present
|
||||||
snapdir: enabled
|
snapdir: enabled
|
||||||
|
|
||||||
# Create a new file system by cloning a snapshot
|
- name: Create a new file system by cloning a snapshot
|
||||||
- zfs:
|
zfs:
|
||||||
name: rpool/cloned_fs
|
name: rpool/cloned_fs
|
||||||
state: present
|
state: present
|
||||||
origin: rpool/myfs@mysnapshot
|
origin: rpool/myfs@mysnapshot
|
||||||
|
|
||||||
# Destroy a filesystem
|
- name: Destroy a filesystem
|
||||||
- zfs:
|
zfs:
|
||||||
name: rpool/myfs
|
name: rpool/myfs
|
||||||
state: absent
|
state: absent
|
||||||
'''
|
'''
|
||||||
|
@ -220,12 +215,12 @@ def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=dict(
|
argument_spec=dict(
|
||||||
name=dict(type='str', required=True),
|
name=dict(type='str', required=True),
|
||||||
state = dict(type='str', required=True, choices=['present', 'absent']),
|
state=dict(type='str', required=True, choices=['absent', 'present']),
|
||||||
# No longer used. Kept here to not interfere with zfs properties
|
# No longer used. Kept here to not interfere with zfs properties
|
||||||
createparent = dict(type='bool', required=False)
|
createparent=dict(type='bool'),
|
||||||
),
|
),
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
check_invalid_arguments=False
|
check_invalid_arguments=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
state = module.params.pop('state')
|
state = module.params.pop('state')
|
||||||
|
@ -245,9 +240,10 @@ def main():
|
||||||
else:
|
else:
|
||||||
properties[prop] = value
|
properties[prop] = value
|
||||||
|
|
||||||
result = {}
|
result = dict(
|
||||||
result['name'] = name
|
name=name,
|
||||||
result['state'] = state
|
state=state,
|
||||||
|
)
|
||||||
|
|
||||||
zfs = Zfs(module, name, properties)
|
zfs = Zfs(module, name, properties)
|
||||||
|
|
||||||
|
|
|
@ -306,4 +306,3 @@ lib/ansible/modules/storage/netapp/netapp_e_storagepool.py
|
||||||
lib/ansible/modules/storage/netapp/sf_snapshot_schedule_manager.py
|
lib/ansible/modules/storage/netapp/sf_snapshot_schedule_manager.py
|
||||||
lib/ansible/modules/storage/netapp/sf_volume_access_group_manager.py
|
lib/ansible/modules/storage/netapp/sf_volume_access_group_manager.py
|
||||||
lib/ansible/modules/storage/netapp/sf_volume_manager.py
|
lib/ansible/modules/storage/netapp/sf_volume_manager.py
|
||||||
lib/ansible/modules/storage/zfs/zfs.py
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue