summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Babushkin <babushkin.max@gmail.com>2019-03-07 21:56:51 +0200
committeransibot <ansibot@users.noreply.github.com>2019-03-07 14:56:50 -0500
commitbf58f84167e662d5d2397884e7af44ac92a4c9e9 (patch)
treef92281475ae5810fe1da5bd346a0edca3b950d91
parent072fa54b50eba8793a380970ea3390b2ac52cdb8 (diff)
downloadansible-bf58f84167e662d5d2397884e7af44ac92a4c9e9.tar.gz
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.
-rw-r--r--lib/ansible/modules/cloud/openstack/os_port.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/ansible/modules/cloud/openstack/os_port.py b/lib/ansible/modules/cloud/openstack/os_port.py
index c1020ef777..5a38fe3063 100644
--- a/lib/ansible/modules/cloud/openstack/os_port.py
+++ b/lib/ansible/modules/cloud/openstack/os_port.py
@@ -86,6 +86,11 @@ options:
choices: [normal, direct, direct-physical, macvtap, baremetal, virtio-forwarder]
default: normal
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 = '''
@@ -202,6 +207,10 @@ vnic_type:
description: Type of the created port
returned: success
type: str
+port_security_enabled:
+ description: Port security state on the network.
+ returned: success
+ type: bool
'''
from ansible.module_utils.basic import AnsibleModule
@@ -217,7 +226,8 @@ def _needs_update(module, port, cloud):
'mac_address',
'device_owner',
'device_id',
- 'binding:vnic_type']
+ 'binding:vnic_type',
+ 'port_security_enabled']
compare_dict = ['allowed_address_pairs',
'extra_dhcp_opts']
compare_list = ['security_groups']
@@ -283,7 +293,8 @@ def _compose_port_args(module, cloud):
'extra_dhcp_opts',
'device_owner',
'device_id',
- 'binding:vnic_type']
+ 'binding:vnic_type',
+ 'port_security_enabled']
for optional_param in optional_parameters:
if module.params[optional_param] is not None:
port_kwargs[optional_param] = module.params[optional_param]
@@ -319,6 +330,7 @@ def main():
vnic_type=dict(default='normal',
choices=['normal', 'direct', 'direct-physical',
'macvtap', 'baremetal', 'virtio-forwarder']),
+ port_security_enabled=dict(default=None, type='bool')
)
module_kwargs = openstack_module_kwargs(