validate-modules: Fix all system modules (#52384)

This PR includes validate-modules fixes for all system modules.
Except a few that are deliberately implemented like this.
This commit is contained in:
Dag Wieers 2019-02-19 15:42:14 +01:00 committed by GitHub
parent c9eb186a94
commit 8c74df5e67
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 568 additions and 495 deletions

View file

@ -1,23 +1,23 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Serge van Ginderachter <serge@vanginderachter.be>
# Copyright: (c) 2013, Serge van Ginderachter <serge@vanginderachter.be>
# 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
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
DOCUMENTATION = r'''
---
module: open_iscsi
author: "Serge van Ginderachter (@srvg)"
author:
- Serge van Ginderachter (@srvg)
version_added: "1.4"
short_description: Manage iscsi targets with open-iscsi
short_description: Manage iSCSI targets with Open-iSCSI
description:
- Discover targets on given portal, (dis)connect targets, mark targets to
manually or auto start, return device nodes of connected targets.
@ -25,85 +25,80 @@ requirements:
- open_iscsi library and tools (iscsiadm)
options:
portal:
required: false
aliases: [ip]
description:
- the ip address of the iscsi target
- The IP address of the iSCSI target.
type: str
aliases: [ ip ]
port:
required: false
description:
- The port on which the iSCSI target process listens.
type: str
default: 3260
description:
- the port on which the iscsi target process listens
target:
required: false
aliases: [name, targetname]
description:
- the iscsi target name
- The iSCSI target name.
type: str
aliases: [ name, targetname ]
login:
required: false
type: bool
description:
- whether the target node should be connected
- Whether the target node should be connected.
type: bool
aliases: [ state ]
node_auth:
required: false
description:
- The value for C(discovery.sendtargets.auth.authmethod).
type: str
default: CHAP
description:
- discovery.sendtargets.auth.authmethod
node_user:
required: false
description:
- discovery.sendtargets.auth.username
- The value for C(discovery.sendtargets.auth.username).
type: str
node_pass:
required: false
description:
- discovery.sendtargets.auth.password
- The value for C(discovery.sendtargets.auth.password).
type: str
auto_node_startup:
aliases: [automatic]
required: false
type: bool
description:
- whether the target node should be automatically connected at startup
- Whether the target node should be automatically connected at startup.
type: bool
aliases: [ automatic ]
discover:
required: false
type: bool
description:
- whether the list of target nodes on the portal should be
(re)discovered and added to the persistent iscsi database.
Keep in mind that iscsiadm discovery resets configurtion, like node.startup
to manual, hence combined with auto_node_startup=yes will always return
- Whether the list of target nodes on the portal should be
(re)discovered and added to the persistent iSCSI database.
- Keep in mind that C(iscsiadm) discovery resets configuration, like C(node.startup)
to manual, hence combined with C(auto_node_startup=yes) will always return
a changed state.
show_nodes:
required: false
type: bool
show_nodes:
description:
- whether the list of nodes in the persistent iscsi database should be
returned by the module
- Whether the list of nodes in the persistent iSCSI database should be returned by the module.
type: bool
'''
EXAMPLES = '''
# perform a discovery on 10.1.2.3 and show available target nodes
- open_iscsi:
EXAMPLES = r'''
- name: Perform a discovery on 10.1.2.3 and show available target nodes
open_iscsi:
show_nodes: yes
discover: yes
portal: 10.1.2.3
# discover targets on portal and login to the one available
# (only works if exactly one target is exported to the initiator)
- open_iscsi:
# NOTE: Only works if exactly one target is exported to the initiator
- name: Discover targets on portal and login to the one available
open_iscsi:
portal: '{{ iscsi_target }}'
login: yes
discover: yes
# description: connect to the named target, after updating the local
# persistent database (cache)
- open_iscsi:
- name: Connect to the named target, after updating the local persistent database (cache)
open_iscsi:
login: yes
target: 'iqn.1986-03.com.sun:02:f8c1f9e0-c3ec-ec84-c9c9-8bfb0cd5de3d'
target: iqn.1986-03.com.sun:02:f8c1f9e0-c3ec-ec84-c9c9-8bfb0cd5de3d
# description: discconnect from the cached named target
- open_iscsi:
- name: Discconnect from the cached named target
open_iscsi:
login: no
target: 'iqn.1986-03.com.sun:02:f8c1f9e0-c3ec-ec84-c9c9-8bfb0cd5de3d'
target: iqn.1986-03.com.sun:02:f8c1f9e0-c3ec-ec84-c9c9-8bfb0cd5de3d
'''
import glob
@ -256,23 +251,23 @@ def main():
argument_spec=dict(
# target
portal=dict(required=False, aliases=['ip']),
port=dict(required=False, default=3260),
target=dict(required=False, aliases=['name', 'targetname']),
node_auth=dict(required=False, default='CHAP'),
node_user=dict(required=False),
node_pass=dict(required=False, no_log=True),
portal=dict(type='str', aliases=['ip']),
port=dict(type='str', default=3260),
target=dict(type='str', aliases=['name', 'targetname']),
node_auth=dict(type='str', default='CHAP'),
node_user=dict(type='str'),
node_pass=dict(type='str', no_log=True),
# actions
login=dict(type='bool', aliases=['state']),
auto_node_startup=dict(type='bool', aliases=['automatic']),
discover=dict(type='bool', default=False),
show_nodes=dict(type='bool', default=False)
show_nodes=dict(type='bool', default=False),
),
required_together=[['discover_user', 'discover_pass'],
['node_user', 'node_pass']],
supports_check_mode=True
supports_check_mode=True,
)
global iscsiadm_cmd