|
|
@ -18,11 +18,11 @@ DOCUMENTATION = '''
|
|
|
|
---
|
|
|
|
---
|
|
|
|
module: azure_rm_subnet
|
|
|
|
module: azure_rm_subnet
|
|
|
|
version_added: "2.1"
|
|
|
|
version_added: "2.1"
|
|
|
|
short_description: Manage Azure subnets.
|
|
|
|
short_description: Manage Azure subnets
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Create, update or delete a subnet within a given virtual network. Allows setting and updating the address
|
|
|
|
- Create, update or delete a subnet within a given virtual network.
|
|
|
|
prefix CIDR, which must be valid within the context of the virtual network. Use the azure_rm_networkinterface
|
|
|
|
- Allows setting and updating the address prefix CIDR, which must be valid within the context of the virtual network.
|
|
|
|
module to associate interfaces with the subnet and assign specific IP addresses.
|
|
|
|
- Use the M(azure_rm_networkinterface) module to associate interfaces with the subnet and assign specific IP addresses.
|
|
|
|
options:
|
|
|
|
options:
|
|
|
|
resource_group:
|
|
|
|
resource_group:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
@ -34,22 +34,20 @@ options:
|
|
|
|
required: true
|
|
|
|
required: true
|
|
|
|
address_prefix_cidr:
|
|
|
|
address_prefix_cidr:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- CIDR defining the IPv4 address space of the subnet. Must be valid within the context of the
|
|
|
|
- CIDR defining the IPv4 address space of the subnet. Must be valid within the context of the virtual network.
|
|
|
|
virtual network.
|
|
|
|
|
|
|
|
aliases:
|
|
|
|
aliases:
|
|
|
|
- address_prefix
|
|
|
|
- address_prefix
|
|
|
|
security_group:
|
|
|
|
security_group:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Existing security group with which to associate the subnet.
|
|
|
|
- Existing security group with which to associate the subnet.
|
|
|
|
- It can be the security group name which is in the same resource group.
|
|
|
|
- It can be the security group name which is in the same resource group.
|
|
|
|
- It can be the resource Id.
|
|
|
|
- Can be the resource ID of the security group.
|
|
|
|
- It can be a dict which contains C(name) and C(resource_group) of the security group.
|
|
|
|
- Can be a dict containing the I(name) and I(resource_group) of the security group.
|
|
|
|
aliases:
|
|
|
|
aliases:
|
|
|
|
- security_group_name
|
|
|
|
- security_group_name
|
|
|
|
state:
|
|
|
|
state:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Assert the state of the subnet. Use C(present) to create or update a subnet and
|
|
|
|
- Assert the state of the subnet. Use C(present) to create or update a subnet and use C(absent) to delete a subnet.
|
|
|
|
C(absent) to delete a subnet.
|
|
|
|
|
|
|
|
default: present
|
|
|
|
default: present
|
|
|
|
choices:
|
|
|
|
choices:
|
|
|
|
- absent
|
|
|
|
- absent
|
|
|
@ -63,9 +61,8 @@ options:
|
|
|
|
route_table:
|
|
|
|
route_table:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- The reference of the RouteTable resource.
|
|
|
|
- The reference of the RouteTable resource.
|
|
|
|
- It can accept both a str or a dict.
|
|
|
|
- Can be the name or resource ID of the route table.
|
|
|
|
- The str can be the name or resource id of the route table.
|
|
|
|
- Can be a dict containing the I(name) and I(resource_group) of the route table.
|
|
|
|
- The dict can contains C(name) and C(resource_group) of the route_table.
|
|
|
|
|
|
|
|
version_added: "2.7"
|
|
|
|
version_added: "2.7"
|
|
|
|
service_endpoints:
|
|
|
|
service_endpoints:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
@ -86,8 +83,8 @@ extends_documentation_fragment:
|
|
|
|
- azure
|
|
|
|
- azure
|
|
|
|
|
|
|
|
|
|
|
|
author:
|
|
|
|
author:
|
|
|
|
- "Chris Houseknecht (@chouseknecht)"
|
|
|
|
- Chris Houseknecht (@chouseknecht)
|
|
|
|
- "Matt Davis (@nitzmahone)"
|
|
|
|
- Matt Davis (@nitzmahone)
|
|
|
|
|
|
|
|
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
@ -120,37 +117,53 @@ EXAMPLES = '''
|
|
|
|
|
|
|
|
|
|
|
|
RETURN = '''
|
|
|
|
RETURN = '''
|
|
|
|
state:
|
|
|
|
state:
|
|
|
|
description: Current state of the subnet.
|
|
|
|
description:
|
|
|
|
|
|
|
|
- Current state of the subnet.
|
|
|
|
returned: success
|
|
|
|
returned: success
|
|
|
|
type: complex
|
|
|
|
type: complex
|
|
|
|
contains:
|
|
|
|
contains:
|
|
|
|
address_prefix:
|
|
|
|
address_prefix:
|
|
|
|
description: IP address CIDR.
|
|
|
|
description:
|
|
|
|
|
|
|
|
- IP address CIDR.
|
|
|
|
|
|
|
|
returned: always
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
example: "10.1.0.0/16"
|
|
|
|
sample: "10.1.0.0/16"
|
|
|
|
id:
|
|
|
|
id:
|
|
|
|
description: Subnet resource path.
|
|
|
|
description:
|
|
|
|
|
|
|
|
- Subnet resource path.
|
|
|
|
|
|
|
|
returned: always
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
example: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVirtualNetwork/subnets/mySubnet"
|
|
|
|
sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVirtualNetwork/subnets/mySubnet"
|
|
|
|
name:
|
|
|
|
name:
|
|
|
|
description: Subnet name.
|
|
|
|
description:
|
|
|
|
|
|
|
|
- Subnet name.
|
|
|
|
|
|
|
|
returned: always
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
example: "foobar"
|
|
|
|
sample: "foobar"
|
|
|
|
network_security_group:
|
|
|
|
network_security_group:
|
|
|
|
|
|
|
|
description:
|
|
|
|
|
|
|
|
- Associated network security group of subnets.
|
|
|
|
|
|
|
|
returned: always
|
|
|
|
type: complex
|
|
|
|
type: complex
|
|
|
|
contains:
|
|
|
|
contains:
|
|
|
|
id:
|
|
|
|
id:
|
|
|
|
description: Security group resource identifier.
|
|
|
|
description:
|
|
|
|
|
|
|
|
- Security group resource identifier.
|
|
|
|
|
|
|
|
returned: always
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
example: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/secgroupfoo"
|
|
|
|
sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/secgroupfoo"
|
|
|
|
name:
|
|
|
|
name:
|
|
|
|
description: Name of the security group.
|
|
|
|
description:
|
|
|
|
|
|
|
|
- Name of the security group.
|
|
|
|
|
|
|
|
returned: always
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
example: "secgroupfoo"
|
|
|
|
sample: "secgroupfoo"
|
|
|
|
provisioning_state:
|
|
|
|
provisioning_state:
|
|
|
|
description: Success or failure of the provisioning event.
|
|
|
|
description:
|
|
|
|
|
|
|
|
- Success or failure of the provisioning event.
|
|
|
|
|
|
|
|
returned: always
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
example: "Succeeded"
|
|
|
|
sample: "Succeeded"
|
|
|
|
''' # NOQA
|
|
|
|
''' # NOQA
|
|
|
|
|
|
|
|
|
|
|
|
from ansible.module_utils.azure_rm_common import AzureRMModuleBase, CIDR_PATTERN, azure_id_to_dict, format_resource_id
|
|
|
|
from ansible.module_utils.azure_rm_common import AzureRMModuleBase, CIDR_PATTERN, azure_id_to_dict, format_resource_id
|
|
|
|