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

Add port_security_enabled argument to os_port module (#47715)

Port security could be set during creation of the port on the network.
Add port_security_enabled boolean during port creation.
This commit is contained in:
Maxim Babushkin 2019-03-07 21:56:51 +02:00 committed by ansibot
parent 072fa54b50
commit bf58f84167

View file

@ -86,6 +86,11 @@ options:
choices: [normal, direct, direct-physical, macvtap, baremetal, virtio-forwarder] choices: [normal, direct, direct-physical, macvtap, baremetal, virtio-forwarder]
default: normal default: normal
version_added: "2.8" version_added: "2.8"
port_security_enabled:
description:
- Whether to enable or disable the port security on the network.
type: bool
version_added: "2.8"
''' '''
EXAMPLES = ''' EXAMPLES = '''
@ -202,6 +207,10 @@ vnic_type:
description: Type of the created port description: Type of the created port
returned: success returned: success
type: str type: str
port_security_enabled:
description: Port security state on the network.
returned: success
type: bool
''' '''
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule
@ -217,7 +226,8 @@ def _needs_update(module, port, cloud):
'mac_address', 'mac_address',
'device_owner', 'device_owner',
'device_id', 'device_id',
'binding:vnic_type'] 'binding:vnic_type',
'port_security_enabled']
compare_dict = ['allowed_address_pairs', compare_dict = ['allowed_address_pairs',
'extra_dhcp_opts'] 'extra_dhcp_opts']
compare_list = ['security_groups'] compare_list = ['security_groups']
@ -283,7 +293,8 @@ def _compose_port_args(module, cloud):
'extra_dhcp_opts', 'extra_dhcp_opts',
'device_owner', 'device_owner',
'device_id', 'device_id',
'binding:vnic_type'] 'binding:vnic_type',
'port_security_enabled']
for optional_param in optional_parameters: for optional_param in optional_parameters:
if module.params[optional_param] is not None: if module.params[optional_param] is not None:
port_kwargs[optional_param] = module.params[optional_param] port_kwargs[optional_param] = module.params[optional_param]
@ -319,6 +330,7 @@ def main():
vnic_type=dict(default='normal', vnic_type=dict(default='normal',
choices=['normal', 'direct', 'direct-physical', choices=['normal', 'direct', 'direct-physical',
'macvtap', 'baremetal', 'virtio-forwarder']), 'macvtap', 'baremetal', 'virtio-forwarder']),
port_security_enabled=dict(default=None, type='bool')
) )
module_kwargs = openstack_module_kwargs( module_kwargs = openstack_module_kwargs(