|
|
|
|
@ -18,51 +18,49 @@ DOCUMENTATION = '''
|
|
|
|
|
---
|
|
|
|
|
module: azure_rm_virtualnetwork
|
|
|
|
|
version_added: "2.1"
|
|
|
|
|
short_description: Manage Azure virtual networks.
|
|
|
|
|
short_description: Manage Azure virtual networks
|
|
|
|
|
description:
|
|
|
|
|
- Create, update or delete a virtual networks. Allows setting and updating the available IPv4 address ranges
|
|
|
|
|
and setting custom DNS servers. Use the azure_rm_subnet module to associate subnets with a virtual network.
|
|
|
|
|
and setting custom DNS servers. Use the M(azure_rm_subnet) module to associate subnets with a virtual network.
|
|
|
|
|
options:
|
|
|
|
|
resource_group:
|
|
|
|
|
description:
|
|
|
|
|
- name of resource group.
|
|
|
|
|
- Name of resource group.
|
|
|
|
|
required: true
|
|
|
|
|
address_prefixes_cidr:
|
|
|
|
|
description:
|
|
|
|
|
- List of IPv4 address ranges where each is formatted using CIDR notation. Required when creating
|
|
|
|
|
a new virtual network or using purge_address_prefixes.
|
|
|
|
|
- List of IPv4 address ranges where each is formatted using CIDR notation.
|
|
|
|
|
- Required when creating a new virtual network or using I(purge_address_prefixes).
|
|
|
|
|
aliases:
|
|
|
|
|
- address_prefixes
|
|
|
|
|
dns_servers:
|
|
|
|
|
description:
|
|
|
|
|
- Custom list of DNS servers. Maximum length of two. The first server in the list will be treated
|
|
|
|
|
as the Primary server. This is an explicit list. Existing DNS servers will be replaced with the
|
|
|
|
|
specified list. Use the purge_dns_servers option to remove all custom DNS servers and revert to
|
|
|
|
|
default Azure servers.
|
|
|
|
|
- Custom list of DNS servers. Maximum length of two.
|
|
|
|
|
- The first server in the list will be treated as the Primary server. This is an explicit list.
|
|
|
|
|
- Existing DNS servers will be replaced with the specified list.
|
|
|
|
|
- Use the I(purge_dns_servers) option to remove all custom DNS servers and revert to default Azure servers.
|
|
|
|
|
location:
|
|
|
|
|
description:
|
|
|
|
|
- Valid azure location. Defaults to location of the resource group.
|
|
|
|
|
- Valid Azure location. Defaults to location of the resource group.
|
|
|
|
|
name:
|
|
|
|
|
description:
|
|
|
|
|
- name of the virtual network.
|
|
|
|
|
- Name of the virtual network.
|
|
|
|
|
required: true
|
|
|
|
|
purge_address_prefixes:
|
|
|
|
|
description:
|
|
|
|
|
- Use with state present to remove any existing address_prefixes.
|
|
|
|
|
- Use with I(state=present) to remove any existing I(address_prefixes).
|
|
|
|
|
type: bool
|
|
|
|
|
default: 'no'
|
|
|
|
|
aliases:
|
|
|
|
|
- purge
|
|
|
|
|
purge_dns_servers:
|
|
|
|
|
description:
|
|
|
|
|
- Use with state present to remove existing DNS servers, reverting to default Azure servers. Mutually
|
|
|
|
|
exclusive with dns_servers.
|
|
|
|
|
- Use with I(state=present) to remove existing DNS servers, reverting to default Azure servers. Mutually exclusive with DNS servers.
|
|
|
|
|
type: bool
|
|
|
|
|
default: 'no'
|
|
|
|
|
state:
|
|
|
|
|
description:
|
|
|
|
|
- Assert the state of the virtual network. Use C(present) to create or update and
|
|
|
|
|
C(absent) to delete.
|
|
|
|
|
- State of the virtual network. Use C(present) to create or update and C(absent) to delete.
|
|
|
|
|
default: present
|
|
|
|
|
choices:
|
|
|
|
|
- absent
|
|
|
|
|
@ -73,8 +71,8 @@ extends_documentation_fragment:
|
|
|
|
|
- azure_tags
|
|
|
|
|
|
|
|
|
|
author:
|
|
|
|
|
- "Chris Houseknecht (@chouseknecht)"
|
|
|
|
|
- "Matt Davis (@nitzmahone)"
|
|
|
|
|
- Chris Houseknecht (@chouseknecht)
|
|
|
|
|
- Matt Davis (@nitzmahone)
|
|
|
|
|
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
@ -101,26 +99,72 @@ EXAMPLES = '''
|
|
|
|
|
'''
|
|
|
|
|
RETURN = '''
|
|
|
|
|
state:
|
|
|
|
|
description: Current state of the virtual network.
|
|
|
|
|
description:
|
|
|
|
|
- Current state of the virtual network.
|
|
|
|
|
returned: always
|
|
|
|
|
type: dict
|
|
|
|
|
sample: {
|
|
|
|
|
"address_prefixes": [
|
|
|
|
|
"10.1.0.0/16",
|
|
|
|
|
"172.100.0.0/16"
|
|
|
|
|
],
|
|
|
|
|
"dns_servers": [
|
|
|
|
|
"127.0.0.1",
|
|
|
|
|
"127.0.0.3"
|
|
|
|
|
],
|
|
|
|
|
"etag": 'W/"0712e87c-f02f-4bb3-8b9e-2da0390a3886"',
|
|
|
|
|
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVirtualNetwork",
|
|
|
|
|
"location": "eastus",
|
|
|
|
|
"name": "my_test_network",
|
|
|
|
|
"provisioning_state": "Succeeded",
|
|
|
|
|
"tags": null,
|
|
|
|
|
"type": "Microsoft.Network/virtualNetworks"
|
|
|
|
|
}
|
|
|
|
|
type: complex
|
|
|
|
|
contains:
|
|
|
|
|
address_prefixes:
|
|
|
|
|
description:
|
|
|
|
|
- The virtual network IPv4 address ranges.
|
|
|
|
|
returned: always
|
|
|
|
|
type: list
|
|
|
|
|
sample: [
|
|
|
|
|
"10.1.0.0/16",
|
|
|
|
|
"172.100.0.0/16"
|
|
|
|
|
]
|
|
|
|
|
dns_servers:
|
|
|
|
|
description:
|
|
|
|
|
- DNS servers.
|
|
|
|
|
returned: always
|
|
|
|
|
type: list
|
|
|
|
|
sample: [
|
|
|
|
|
"127.0.0.1",
|
|
|
|
|
"127.0.0.3"
|
|
|
|
|
]
|
|
|
|
|
etag:
|
|
|
|
|
description:
|
|
|
|
|
- A unique read-only string that changes whenever the resource is update.
|
|
|
|
|
returned: always
|
|
|
|
|
type: str
|
|
|
|
|
sample: 'W/"0712e87c-f02f-4bb3-8b9e-2da0390a3886"'
|
|
|
|
|
id:
|
|
|
|
|
description:
|
|
|
|
|
- Resource ID.
|
|
|
|
|
returned: always
|
|
|
|
|
type: str
|
|
|
|
|
sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/
|
|
|
|
|
Microsoft.Network/virtualNetworks/myVirtualNetwork"
|
|
|
|
|
location:
|
|
|
|
|
description:
|
|
|
|
|
- The Geo-location where the resource lives.
|
|
|
|
|
returned: always
|
|
|
|
|
type: str
|
|
|
|
|
sample: eastus
|
|
|
|
|
name:
|
|
|
|
|
description:
|
|
|
|
|
- Resource name.
|
|
|
|
|
returned: always
|
|
|
|
|
type: str
|
|
|
|
|
sample: my_test_network
|
|
|
|
|
provisioning_state:
|
|
|
|
|
description:
|
|
|
|
|
- Provisioning state of the virtual network.
|
|
|
|
|
returned: always
|
|
|
|
|
type: str
|
|
|
|
|
sample: Succeeded
|
|
|
|
|
tags:
|
|
|
|
|
description:
|
|
|
|
|
- Resource tags, such as { 'tags1':'value1' }
|
|
|
|
|
returned: always
|
|
|
|
|
type: dict
|
|
|
|
|
sample: { 'key1':'value1' }
|
|
|
|
|
type:
|
|
|
|
|
descriptioin:
|
|
|
|
|
- Resource type.
|
|
|
|
|
returned: always
|
|
|
|
|
type: str
|
|
|
|
|
sample: Microsoft.Network/virtualNetworks
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|