mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Change required parameters for rules module
The ports and protocol are no longer required (and now depends on a new version of shade).
This commit is contained in:
parent
531b93490b
commit
387fe5b0e7
1 changed files with 49 additions and 6 deletions
|
@ -18,8 +18,10 @@
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import shade
|
import shade
|
||||||
|
HAS_SHADE = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print("failed=True msg='shade is required for this module'")
|
HAS_SHADE = False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
|
@ -89,6 +91,41 @@ EXAMPLES = '''
|
||||||
remote_ip_prefix: 0.0.0.0/0
|
remote_ip_prefix: 0.0.0.0/0
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
RETURN = '''
|
||||||
|
id:
|
||||||
|
description: Unique rule UUID.
|
||||||
|
type: string
|
||||||
|
direction:
|
||||||
|
description: The direction in which the security group rule is applied.
|
||||||
|
type: string
|
||||||
|
sample: 'egress'
|
||||||
|
ethertype:
|
||||||
|
description: One of IPv4 or IPv6.
|
||||||
|
type: string
|
||||||
|
sample: 'IPv4'
|
||||||
|
port_range_min:
|
||||||
|
description: The minimum port number in the range that is matched by
|
||||||
|
the security group rule.
|
||||||
|
type: int
|
||||||
|
sample: 8000
|
||||||
|
port_range_max:
|
||||||
|
description: The maximum port number in the range that is matched by
|
||||||
|
the security group rule.
|
||||||
|
type: int
|
||||||
|
sample: 8000
|
||||||
|
protocol:
|
||||||
|
description: The protocol that is matched by the security group rule.
|
||||||
|
type: string
|
||||||
|
sample: 'tcp'
|
||||||
|
remote_ip_prefix:
|
||||||
|
description: The remote IP prefix to be associated with this security group rule.
|
||||||
|
type: string
|
||||||
|
sample: '0.0.0.0/0'
|
||||||
|
security_group_id:
|
||||||
|
description: The security group ID to associate with this security group rule.
|
||||||
|
type: string
|
||||||
|
'''
|
||||||
|
|
||||||
|
|
||||||
def _find_matching_rule(module, secgroup):
|
def _find_matching_rule(module, secgroup):
|
||||||
"""
|
"""
|
||||||
|
@ -143,10 +180,12 @@ def main():
|
||||||
|
|
||||||
argument_spec = openstack_full_argument_spec(
|
argument_spec = openstack_full_argument_spec(
|
||||||
security_group = dict(required=True),
|
security_group = dict(required=True),
|
||||||
protocol = dict(default='tcp',
|
# NOTE(Shrews): None is an acceptable protocol value for
|
||||||
choices=['tcp', 'udp', 'icmp']),
|
# Neutron, but Nova will balk at this.
|
||||||
port_range_min = dict(required=True, type='int'),
|
protocol = dict(default=None,
|
||||||
port_range_max = dict(required=True, type='int'),
|
choices=[None, 'tcp', 'udp', 'icmp']),
|
||||||
|
port_range_min = dict(required=False, type='int'),
|
||||||
|
port_range_max = dict(required=False, type='int'),
|
||||||
remote_ip_prefix = dict(required=False, default=None),
|
remote_ip_prefix = dict(required=False, default=None),
|
||||||
# TODO(mordred): Make remote_group handle name and id
|
# TODO(mordred): Make remote_group handle name and id
|
||||||
remote_group = dict(required=False, default=None),
|
remote_group = dict(required=False, default=None),
|
||||||
|
@ -168,6 +207,9 @@ def main():
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
**module_kwargs)
|
**module_kwargs)
|
||||||
|
|
||||||
|
if not HAS_SHADE:
|
||||||
|
module.fail_json(msg='shade is required for this module')
|
||||||
|
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
security_group = module.params['security_group']
|
security_group = module.params['security_group']
|
||||||
changed = False
|
changed = False
|
||||||
|
@ -214,4 +256,5 @@ def main():
|
||||||
from ansible.module_utils.basic import *
|
from ansible.module_utils.basic import *
|
||||||
from ansible.module_utils.openstack import *
|
from ansible.module_utils.openstack import *
|
||||||
|
|
||||||
main()
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
|
Loading…
Reference in a new issue