From 6c74e29618a6872bc0da66e4992cfcd9cebf6acc Mon Sep 17 00:00:00 2001 From: Raimund Hook <1150270+StingRayZA@users.noreply.github.com> Date: Fri, 24 May 2019 16:27:20 +0100 Subject: [PATCH] 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) --- ...ork-dns_domain-support-on-create-update.yml | 3 +++ .../modules/cloud/openstack/os_network.py | 18 +++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/56453-os-network-dns_domain-support-on-create-update.yml diff --git a/changelogs/fragments/56453-os-network-dns_domain-support-on-create-update.yml b/changelogs/fragments/56453-os-network-dns_domain-support-on-create-update.yml new file mode 100644 index 00000000000..b7020e27656 --- /dev/null +++ b/changelogs/fragments/56453-os-network-dns_domain-support-on-create-update.yml @@ -0,0 +1,3 @@ +--- +minor_changes: + - os_network - added dns_domain support when creating/updating a network diff --git a/lib/ansible/modules/cloud/openstack/os_network.py b/lib/ansible/modules/cloud/openstack/os_network.py index d170b997460..79f4b0f9e35 100644 --- a/lib/ansible/modules/cloud/openstack/os_network.py +++ b/lib/ansible/modules/cloud/openstack/os_network.py @@ -83,6 +83,12 @@ options: not provided. type: int 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: - "openstacksdk" ''' @@ -122,6 +128,10 @@ network: description: The MTU of a network resource. type: int sample: 0 + dns_domain: + description: The DNS domain of a network resource. + type: str + sample: "sample.openstack.org." admin_state_up: description: The administrative state of the network. type: bool @@ -172,7 +182,8 @@ def main(): state=dict(default='present', choices=['absent', 'present']), project=dict(default=None), 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() @@ -189,6 +200,7 @@ def main(): project = module.params.get('project') port_security_enabled = module.params.get('port_security_enabled') mtu = module.params.get('mtu') + dns_domain = module.params.get('dns_domain') sdk, cloud = openstack_cloud_from_module(module) try: @@ -217,12 +229,12 @@ def main(): net = cloud.create_network(name, shared, admin_state_up, external, provider, project_id, port_security_enabled=port_security_enabled, - mtu_size=mtu) + mtu_size=mtu, dns_domain=dns_domain) else: net = cloud.create_network(name, shared, admin_state_up, external, provider, port_security_enabled=port_security_enabled, - mtu_size=mtu) + mtu_size=mtu, dns_domain=dns_domain) changed = True else: changed = False