|
|
@ -89,6 +89,11 @@ options:
|
|
|
|
- The ip that would be assigned to the gateway for this subnet
|
|
|
|
- The ip that would be assigned to the gateway for this subnet
|
|
|
|
required: false
|
|
|
|
required: false
|
|
|
|
default: None
|
|
|
|
default: None
|
|
|
|
|
|
|
|
dns_nameservers:
|
|
|
|
|
|
|
|
description:
|
|
|
|
|
|
|
|
- DNS nameservers for this subnet, comma-separated
|
|
|
|
|
|
|
|
required: false
|
|
|
|
|
|
|
|
default: None
|
|
|
|
allocation_pool_start:
|
|
|
|
allocation_pool_start:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- From the subnet pool the starting address from which the IP should be allocated
|
|
|
|
- From the subnet pool the starting address from which the IP should be allocated
|
|
|
@ -202,6 +207,7 @@ def _create_subnet(module, quantum):
|
|
|
|
'enable_dhcp': module.params['enable_dhcp'],
|
|
|
|
'enable_dhcp': module.params['enable_dhcp'],
|
|
|
|
'tenant_id': _os_tenant_id,
|
|
|
|
'tenant_id': _os_tenant_id,
|
|
|
|
'gateway_ip': module.params['gateway_ip'],
|
|
|
|
'gateway_ip': module.params['gateway_ip'],
|
|
|
|
|
|
|
|
'dns_nameservers': module.params['dns_nameservers'],
|
|
|
|
'network_id': _os_network_id,
|
|
|
|
'network_id': _os_network_id,
|
|
|
|
'cidr': module.params['cidr'],
|
|
|
|
'cidr': module.params['cidr'],
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -215,6 +221,10 @@ def _create_subnet(module, quantum):
|
|
|
|
subnet.update({'allocation_pools': allocation_pools})
|
|
|
|
subnet.update({'allocation_pools': allocation_pools})
|
|
|
|
if not module.params['gateway_ip']:
|
|
|
|
if not module.params['gateway_ip']:
|
|
|
|
subnet.pop('gateway_ip')
|
|
|
|
subnet.pop('gateway_ip')
|
|
|
|
|
|
|
|
if module.params['dns_nameservers']:
|
|
|
|
|
|
|
|
subnet['dns_nameservers'] = module.params['dns_nameservers'].split(',')
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
subnet.pop('dns_nameservers')
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
new_subnet = quantum.create_subnet(dict(subnet=subnet))
|
|
|
|
new_subnet = quantum.create_subnet(dict(subnet=subnet))
|
|
|
|
except Exception, e:
|
|
|
|
except Exception, e:
|
|
|
@ -247,6 +257,7 @@ def main():
|
|
|
|
ip_version = dict(default='4', choices=['4', '6']),
|
|
|
|
ip_version = dict(default='4', choices=['4', '6']),
|
|
|
|
enable_dhcp = dict(default='true', choices=BOOLEANS),
|
|
|
|
enable_dhcp = dict(default='true', choices=BOOLEANS),
|
|
|
|
gateway_ip = dict(default=None),
|
|
|
|
gateway_ip = dict(default=None),
|
|
|
|
|
|
|
|
dns_nameservers = dict(default=None),
|
|
|
|
allocation_pool_start = dict(default=None),
|
|
|
|
allocation_pool_start = dict(default=None),
|
|
|
|
allocation_pool_end = dict(default=None),
|
|
|
|
allocation_pool_end = dict(default=None),
|
|
|
|
),
|
|
|
|
),
|
|
|
|