Skip to content

Commit

Permalink
Add dns_domain into os_network.py (ansible#56453)
Browse files Browse the repository at this point in the history
* Add dns_domain into os_network.py

* Added changelog fragment for PR 56453

* fixed linting issue (lib/ansible/modules/cloud/openstack/os_network.py)
  • Loading branch information
StingRayZA authored and emonty committed May 24, 2019
1 parent bc50a52 commit 6c74e29
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
minor_changes:
- os_network - added dns_domain support when creating/updating a network
18 changes: 15 additions & 3 deletions lib/ansible/modules/cloud/openstack/os_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@
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"
'''
Expand Down Expand Up @@ -122,6 +128,10 @@
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
Expand Down Expand Up @@ -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()
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6c74e29

Please sign in to comment.