@ -1,115 +1,73 @@
#!/usr/bin/python
#!/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
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# (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
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# 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 = '''
DOCUMENTATION = '''
- - -
- - -
module : ec2_vpc_subnet
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 :
description :
- Create or removes AWS subnets in a VPC . This module has a '''
- Manage subnets in AWS virtual private clouds
''' dependency on python-boto.
version_added : " 2.0 "
version_added: " 1.8 "
author: Robert Estelle , @erydo
options :
options :
vpc_id :
vpc_id :
description :
description :
- A VPC id in which the subnet resides
- VPC ID of the VPC in which to create the subnet .
required : false
required : false
default : null
default : null
aliases : [ ]
resource_tags :
resource_tags :
description :
description :
- ' A dictionary array of resource tags of the form: { tag1: value1, ' ' '
- 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.
''' 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
required : false
default : null
default : null
aliases : [ ]
cidr :
cidr :
description :
description :
- " The cidr block for the subnet, e.g. 10.0.0.0/16 "
- The CIDR block for the subnet . E . g . 10.0 .0 .0 / 16. Only required when state = present . "
required : false , unless state = present
required : false
az :
az :
description :
description :
- " The availability zone for the subnet "
- " The availability zone for the subnet. Only required when state=present. "
required : false , unless state = present
region :
description :
- region in which the resource exists .
required : false
required : false
default : null
aliases : [ ' aws_region ' , ' ec2_region ' ]
state :
state :
description :
description :
- Create or remove the subnet
- Create or remove the subnet
required : true
required : true
default : present
default : present
aliases : [ ]
choices : [ ' present ' , ' absent ' ]
aws_secret_key :
extends_documentation_fragment : aws
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
'''
'''
EXAMPLES = '''
EXAMPLES = '''
# Note: None of these examples set aws_access_key, aws_secret_key, or region.
# Note: These examples do not set authentication details, see the AWS Guide for details.
# It is assumed that their matching environment variables are set.
# Basic creation example:
- name : Create subnet for database servers
- name : Set up the subnet for database servers
ec2_vpc_subnet :
local_action :
module : ec2_vpc_subnet
state : present
state : present
vpc_id : vpc - 123456
vpc_id : vpc - 123456
region : us - west - 1
cidr : 10.0 .1 .16 / 28
cidr : 10.0 .1 .16 / 28
resource_tags :
resource_tags :
Name : Database Subnet
Name : Database Subnet
register : database_subnet
register : database_subnet
# Removal of a VPC by id
- name : Remove subnet for database servers
- name : Set up the subnet for database servers
ec2_vpc_subnet :
local_action :
module : ec2_vpc
state : absent
state : absent
vpc_id : vpc - 123456
vpc_id : vpc - 123456
region : us - west - 1
cidr : 10.0 .1 .16 / 28
cidr : 10.0 .1 .16 / 28
'''
'''
import sys # noqa
import sys # noqa
import time
import time
@ -288,3 +246,4 @@ from ansible.module_utils.ec2 import * # noqa
if __name__ == ' __main__ ' :
if __name__ == ' __main__ ' :
main ( )
main ( )