Merge "Allows to setup more than one nameserver"

This commit is contained in:
Jenkins 2017-07-21 10:06:22 +00:00 committed by Gerrit Code Review
commit 971b17bbfb
4 changed files with 19 additions and 13 deletions

View File

@ -29,7 +29,7 @@ def main():
ipv4_address=dict(required=False),
ipv4_gateway=dict(required=False),
ipv4_interface_mac=dict(required=False),
ipv4_nameserver=dict(required=False),
ipv4_nameserver=dict(required=False, type='list'),
ipv4_subnet_mask=dict(required=False),
vlan_id=dict(required=False),
network_mtu=dict(required=False),
@ -73,9 +73,7 @@ def main():
'type': 'ipv4',
'ip_address': module.params['ipv4_address'],
'netmask': module.params['ipv4_subnet_mask'],
'dns_nameservers': [
module.params['ipv4_nameserver']
],
'dns_nameservers': module.params['ipv4_nameserver'],
'routes': [{
'network': '0.0.0.0',
'netmask': '0.0.0.0',
@ -110,9 +108,7 @@ def main():
'type': 'ipv4',
'ip_address': module.params['ipv4_address'],
'netmask': module.params['ipv4_subnet_mask'],
'dns_nameservers': [
module.params['ipv4_nameserver']
],
'dns_nameservers': module.params['ipv4_nameserver'],
'routes': [{
'network': '0.0.0.0',
'netmask': '0.0.0.0',
@ -128,10 +124,11 @@ def main():
services = []
if module.params['ipv4_nameserver']:
services.append({
'type': 'dns',
'address': module.params['ipv4_nameserver']
})
for item in module.params['ipv4_nameserver']:
services.append({
'type': 'dns',
'address': module.params['ipv4_nameserver']
})
network_metadata = {
'links': links,

View File

@ -44,7 +44,9 @@ node_default_network_interface: This is the default network interface within
required.
ipv4_nameserver: Defines the IPv4 nameserver to configure the node with
initially in order to support name resolution.
initially in order to support name resolution. It accepts
a string with a single nameserver, or a list with several
ones.
ipv4_address: The IPv4 address of the node to be deployed, if applicable.

View File

@ -50,7 +50,7 @@
ipv4_address: "{{ ipv4_address | default('') }}"
ipv4_gateway: "{{ ipv4_gateway | default('') }}"
ipv4_interface_mac: "{{ ipv4_interface_mac | default('') }}"
ipv4_nameserver: "{{ ipv4_nameserver | default('') }}"
ipv4_nameserver: "{% if ipv4_nameserver is string %}['{{ ipv4_nameserver | default('') }}']{% else %}{{ ipv4_nameserver }}{% endif %}"
ipv4_subnet_mask: "{{ ipv4_subnet_mask | default('') }}"
vlan_id: "{{ vlan_id | default('') }}"
network_mtu: "{{ network_mtu | default('1500') }}"

View File

@ -0,0 +1,7 @@
---
features:
- Allows to set more than one nameserver in the
provisioned instances. The ipv4_nameserver setting
can now accept either a string or a list of strings,
allowing to populate all desired nameservers.