@ -1,115 +1,73 @@
#!/usr/bin/python
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# This is a free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# This Ansible library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible . If not, see <http://www.gnu.org/licenses/>.
# along with this library . If not, see <http://www.gnu.org/licenses/>.
DOCUMENTATION = '''
- - -
module : ec2_vpc_subnet
short_description : Configur e subnets in AWS virtual private clouds .
short_description : Manag e subnets in AWS virtual private clouds
description :
- Create or removes AWS subnets in a VPC . This module has a '''
''' dependency on python-boto.
version_added: " 1.8 "
- Manage subnets in AWS virtual private clouds
version_added : " 2.0 "
author: Robert Estelle , @erydo
options :
vpc_id :
description :
- A VPC id in which the subnet resides
- VPC ID of the VPC in which to create the subnet .
required : false
default : null
aliases : [ ]
resource_tags :
description :
- ' A dictionary array of resource tags of the form: { tag1: value1, ' ' '
''' tag2: value2 }. This module identifies a subnet by CIDR and will update '''
''' the subnet ' s tags to match. Tags not in this list will be ignored.
- A dictionary array of resource tags of the form : { tag1 : value1 , tag2 : value2 } . This module identifies a subnet by CIDR and will update the subnet ' s tags to match. Tags not in this list will be ignored.
required : false
default : null
aliases : [ ]
cidr :
description :
- " The cidr block for the subnet, e.g. 10.0.0.0/16 "
required : false , unless state = present
- The CIDR block for the subnet . E . g . 10.0 .0 .0 / 16. Only required when state = present . "
required : false
az :
description :
- " The availability zone for the subnet "
required : false , unless state = present
region :
description :
- region in which the resource exists .
- " The availability zone for the subnet. Only required when state=present. "
required : false
default : null
aliases : [ ' aws_region ' , ' ec2_region ' ]
state :
description :
- Create or remove the subnet
required : true
default : present
aliases : [ ]
aws_secret_key :
description :
- AWS secret key . If not set then the value of the AWS_SECRET_KEY '''
''' environment variable is used.
required : false
default : None
aliases : [ ' ec2_secret_key ' , ' secret_key ' ]
aws_access_key :
description :
- AWS access key . If not set then the value of the AWS_ACCESS_KEY '''
''' environment variable is used.
required : false
default : None
aliases : [ ' ec2_access_key ' , ' access_key ' ]
validate_certs :
description :
- When set to " no " , SSL certificates will not be validated for '''
''' boto versions >= 2.6.0.
required : false
default : " yes "
choices : [ " yes " , " no " ]
aliases : [ ]
requirements : [ " boto " ]
author : Robert Estelle
choices : [ ' present ' , ' absent ' ]
extends_documentation_fragment : aws
'''
EXAMPLES = '''
# Note: None of these examples set aws_access_key, aws_secret_key, or region.
# It is assumed that their matching environment variables are set.
# Note: These examples do not set authentication details, see the AWS Guide for details.
# Basic creation example:
- name : Set up the subnet for database servers
local_action :
module : ec2_vpc_subnet
- name : Create subnet for database servers
ec2_vpc_subnet :
state : present
vpc_id : vpc - 123456
region : us - west - 1
cidr : 10.0 .1 .16 / 28
resource_tags :
Name : Database Subnet
register : database_subnet
# Removal of a VPC by id
- name : Set up the subnet for database servers
local_action :
module : ec2_vpc
- name : Remove subnet for database servers
ec2_vpc_subnet :
state : absent
vpc_id : vpc - 123456
region : us - west - 1
cidr : 10.0 .1 .16 / 28
'''
'''
import sys # noqa
import time
@ -288,3 +246,4 @@ from ansible.module_utils.ec2 import * # noqa
if __name__ == ' __main__ ' :
main ( )