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

Add dns_domain into os_network.py (#56453)

* Add dns_domain into os_network.py

* Added changelog fragment for PR 56453

* fixed linting issue (lib/ansible/modules/cloud/openstack/os_network.py)
This commit is contained in:
Raimund Hook 2019-05-24 16:27:20 +01:00 committed by Monty Taylor
parent bc50a52ee2
commit 6c74e29618
2 changed files with 18 additions and 3 deletions

View file

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

View file

@ -83,6 +83,12 @@ options:
not provided. not provided.
type: int type: int
version_added: "2.9" version_added: "2.9"
dns_domain:
description:
- The DNS domain value to set.
Network will use Openstack defaults if this option is
not provided.
version_added: "2.9"
requirements: requirements:
- "openstacksdk" - "openstacksdk"
''' '''
@ -122,6 +128,10 @@ network:
description: The MTU of a network resource. description: The MTU of a network resource.
type: int type: int
sample: 0 sample: 0
dns_domain:
description: The DNS domain of a network resource.
type: str
sample: "sample.openstack.org."
admin_state_up: admin_state_up:
description: The administrative state of the network. description: The administrative state of the network.
type: bool type: bool
@ -172,7 +182,8 @@ def main():
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') mtu=dict(required=False, type='int'),
dns_domain=dict(required=False)
) )
module_kwargs = openstack_module_kwargs() module_kwargs = openstack_module_kwargs()
@ -189,6 +200,7 @@ def main():
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') mtu = module.params.get('mtu')
dns_domain = module.params.get('dns_domain')
sdk, cloud = openstack_cloud_from_module(module) sdk, cloud = openstack_cloud_from_module(module)
try: try:
@ -217,12 +229,12 @@ def main():
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) mtu_size=mtu, dns_domain=dns_domain)
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) mtu_size=mtu, dns_domain=dns_domain)
changed = True changed = True
else: else:
changed = False changed = False