mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Accept list or string for ports is seport module (#36661)
* Accept list or string for ports is seport module Fixes #36466 * Update docs
This commit is contained in:
parent
a1026dbce5
commit
aeb56e4bbe
1 changed files with 13 additions and 4 deletions
|
@ -15,12 +15,12 @@ DOCUMENTATION = '''
|
||||||
module: seport
|
module: seport
|
||||||
short_description: Manages SELinux network port type definitions
|
short_description: Manages SELinux network port type definitions
|
||||||
description:
|
description:
|
||||||
- Manages SELinux network port type definitions.
|
- Manages SELinux network port type definitions.
|
||||||
version_added: "2.0"
|
version_added: "2.0"
|
||||||
options:
|
options:
|
||||||
ports:
|
ports:
|
||||||
description:
|
description:
|
||||||
- Ports or port ranges, separated by a comma.
|
- Ports or port ranges. Can be a list (since 2.6) or comma separated string.
|
||||||
required: true
|
required: true
|
||||||
proto:
|
proto:
|
||||||
description:
|
description:
|
||||||
|
@ -73,6 +73,15 @@ EXAMPLES = '''
|
||||||
proto: tcp
|
proto: tcp
|
||||||
setype: memcache_port_t
|
setype: memcache_port_t
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
|
- name: Allow memcached to listen on tcp ports 10000-10100 and 10112
|
||||||
|
seport:
|
||||||
|
ports:
|
||||||
|
- 10000-10100
|
||||||
|
- 10112
|
||||||
|
proto: tcp
|
||||||
|
setype: memcache_port_t
|
||||||
|
state: present
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import traceback
|
import traceback
|
||||||
|
@ -231,7 +240,7 @@ def semanage_port_del(module, ports, proto, setype, do_reload, sestore=''):
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=dict(
|
argument_spec=dict(
|
||||||
ports=dict(type='str', required=True),
|
ports=dict(type='list', required=True),
|
||||||
proto=dict(type='str', required=True, choices=['tcp', 'udp']),
|
proto=dict(type='str', required=True, choices=['tcp', 'udp']),
|
||||||
setype=dict(type='str', required=True),
|
setype=dict(type='str', required=True),
|
||||||
state=dict(type='str', required=True, choices=['absent', 'present']),
|
state=dict(type='str', required=True, choices=['absent', 'present']),
|
||||||
|
@ -249,7 +258,7 @@ def main():
|
||||||
if not selinux.is_selinux_enabled():
|
if not selinux.is_selinux_enabled():
|
||||||
module.fail_json(msg="SELinux is disabled on this host.")
|
module.fail_json(msg="SELinux is disabled on this host.")
|
||||||
|
|
||||||
ports = [x.strip() for x in str(module.params['ports']).split(',')]
|
ports = module.params['ports']
|
||||||
proto = module.params['proto']
|
proto = module.params['proto']
|
||||||
setype = module.params['setype']
|
setype = module.params['setype']
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
|
|
Loading…
Reference in a new issue