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

Added the mtu property to the os_network module (#55881) (#54730)

The networking API v2 specification, which is implemented
by openstack neutron, features an optional MTU parameter that
allows operators to specify the value for the maximum
transmission unit value.
This commit is contained in:
Miguel Duarte Barroso 2019-05-12 10:26:27 +02:00 committed by René Moser
parent 1a6b95a8f1
commit c6a8e99d34
2 changed files with 17 additions and 3 deletions

View file

@ -0,0 +1,3 @@
---
minor_changes:
- os_network - added MTU support when creating/updating a network

View file

@ -76,6 +76,13 @@ options:
not utilised. not utilised.
type: bool type: bool
version_added: "2.8" version_added: "2.8"
mtu:
description:
- The maximum transmission unit (MTU) value to address fragmentation.
Network will use OpenStack defaults if this option is
not provided.
type: int
version_added: "2.9"
requirements: requirements:
- "openstacksdk" - "openstacksdk"
''' '''
@ -164,7 +171,8 @@ def main():
provider_segmentation_id=dict(required=False, type='int'), provider_segmentation_id=dict(required=False, type='int'),
state=dict(default='present', choices=['absent', 'present']), state=dict(default='present', choices=['absent', 'present']),
project=dict(default=None), project=dict(default=None),
port_security_enabled=dict(type='bool') port_security_enabled=dict(type='bool'),
mtu=dict(required=False, type='int')
) )
module_kwargs = openstack_module_kwargs() module_kwargs = openstack_module_kwargs()
@ -180,6 +188,7 @@ def main():
provider_segmentation_id = module.params['provider_segmentation_id'] provider_segmentation_id = module.params['provider_segmentation_id']
project = module.params.get('project') project = module.params.get('project')
port_security_enabled = module.params.get('port_security_enabled') port_security_enabled = module.params.get('port_security_enabled')
mtu = module.params.get('mtu')
sdk, cloud = openstack_cloud_from_module(module) sdk, cloud = openstack_cloud_from_module(module)
try: try:
@ -207,11 +216,13 @@ def main():
if project_id is not None: if project_id is not None:
net = cloud.create_network(name, shared, admin_state_up, net = cloud.create_network(name, shared, admin_state_up,
external, provider, project_id, external, provider, project_id,
port_security_enabled=port_security_enabled) port_security_enabled=port_security_enabled,
mtu_size=mtu)
else: else:
net = cloud.create_network(name, shared, admin_state_up, net = cloud.create_network(name, shared, admin_state_up,
external, provider, external, provider,
port_security_enabled=port_security_enabled) port_security_enabled=port_security_enabled,
mtu_size=mtu)
changed = True changed = True
else: else:
changed = False changed = False