Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
configuration
Commits
1846b267
Commit
1846b267
authored
Sep 17, 2014
by
e0d
Committed by
Feanil Patel
May 11, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mostly stubbed
parent
bea19a7f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
102 additions
and
0 deletions
+102
-0
playbooks/library/ec2_rt
+102
-0
No files found.
playbooks/library/ec2_rt
0 → 100644
View file @
1846b267
#!/usr/bin/env python
# This file is part of Ansible
#
# Ansible is 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,
# 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/>.
DOCUMENTATION
=
"""
---
module: ec2_rt
short_description: Create or delete AWS Route Table
description:
- Can create or delete AwS Subnets
version_added: "1.8"
author: Edward Zarecor
options:
state:
description:
- create, update or delete the subnet
required: true
choices: ['present', 'absent']
name:
description:
- Unique name for subnet
required: true
cidr_block:
description:
- The cidr block of the subnet
aliases: ['cidr']
availability_zone
description:
- The availability zone of the subnet
aliases: ['az']
vpc_id:
description:
- The VPC that this acl belongs to
required: true
default: null
extends_documentation_fragment: aws
"""
EXAMPLES
=
'''
'''
from
ansible.module_utils.basic
import
*
from
ansible.module_utils.ec2
import
*
import
sys
try
:
import
boto.vpc
except
ImportError
:
print
"failed=True msg={0}"
.
format
(
sys
.
executable
)
#print "failed=True msg='boto required for this module'"
sys
.
exit
(
1
)
def
present
(
connection
,
module
):
module
.
exit_json
(
id
=
"1"
)
def
absent
(
connection
,
module
):
module
.
exit_json
(
id
=
"-1"
)
def
main
():
argument_spec
=
ec2_argument_spec
()
argument_spec
.
update
(
dict
(
name
=
dict
(
required
=
True
,
type
=
'str'
),
state
=
dict
(
default
=
'present'
,
choices
=
[
'present'
,
'absent'
]),
vpc_id
=
dict
(
required
=
True
,
type
=
'str'
),
destination_cidr
=
dict
(
required
=
True
,
type
=
'str'
),
target
=
dict
(
required
=
True
,
type
=
'str'
),
tags
=
dict
(
type
=
'list'
),
)
)
module
=
AnsibleModule
(
argument_spec
=
argument_spec
)
ec2_url
,
aws_access_key
,
aws_secret_key
,
region
=
get_ec2_creds
(
module
)
profile
=
module
.
params
.
get
(
'profile'
)
if
region
:
try
:
connection
=
boto
.
vpc
.
connect_to_region
(
region
,
profile_name
=
profile
)
except
boto
.
exception
.
NoAuthHandlerFound
,
e
:
module
.
fail_json
(
msg
=
str
(
e
))
else
:
module
.
fail_json
(
msg
=
"region must be specified"
)
state
=
module
.
params
.
get
(
'state'
)
if
state
==
'present'
:
present
(
connection
,
module
)
elif
state
==
'absent'
:
absent
(
connection
,
module
)
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment