Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
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
ansible
Commits
1410df43
Commit
1410df43
authored
Aug 02, 2013
by
Ben Podoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding param to allow for specifying custom iops setting when creating an EBS volume
parent
d485abe2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
2 deletions
+26
-2
library/cloud/ec2_vol
+26
-2
No files found.
library/cloud/ec2_vol
View file @
1410df43
...
@@ -34,6 +34,12 @@ options:
...
@@ -34,6 +34,12 @@ options:
required: true
required: true
default: null
default: null
aliases: []
aliases: []
iops:
description:
- the provisioned IOPs you want to associate with this volume (integer).
required: false
default: 100
aliases: []
device_name:
device_name:
description:
description:
- device id to override device mapping. Assumes /dev/sdf for Linux/UNIX and /dev/xvdf for Windows.
- device id to override device mapping. Assumes /dev/sdf for Linux/UNIX and /dev/xvdf for Windows.
...
@@ -63,7 +69,15 @@ EXAMPLES = '''
...
@@ -63,7 +69,15 @@ EXAMPLES = '''
instance: XXXXXX
instance: XXXXXX
volume_size: 5
volume_size: 5
device_name: sdd
device_name: sdd
# Example using custom iops params
- local_action:
module: ec2_vol
instance: XXXXXX
volume_size: 5
iops: 200
device_name: sdd
# Playbook example combined with instance launch
# Playbook example combined with instance launch
- local_action:
- local_action:
module: ec2
module: ec2
...
@@ -99,6 +113,7 @@ def main():
...
@@ -99,6 +113,7 @@ def main():
argument_spec
=
dict
(
argument_spec
=
dict
(
instance
=
dict
(),
instance
=
dict
(),
volume_size
=
dict
(
required
=
True
),
volume_size
=
dict
(
required
=
True
),
iops
=
dict
(),
device_name
=
dict
(),
device_name
=
dict
(),
region
=
dict
(),
region
=
dict
(),
zone
=
dict
(),
zone
=
dict
(),
...
@@ -110,6 +125,7 @@ def main():
...
@@ -110,6 +125,7 @@ def main():
instance
=
module
.
params
.
get
(
'instance'
)
instance
=
module
.
params
.
get
(
'instance'
)
volume_size
=
module
.
params
.
get
(
'volume_size'
)
volume_size
=
module
.
params
.
get
(
'volume_size'
)
iops
=
module
.
params
.
get
(
'iops'
)
device_name
=
module
.
params
.
get
(
'device_name'
)
device_name
=
module
.
params
.
get
(
'device_name'
)
region
=
module
.
params
.
get
(
'region'
)
region
=
module
.
params
.
get
(
'region'
)
zone
=
module
.
params
.
get
(
'zone'
)
zone
=
module
.
params
.
get
(
'zone'
)
...
@@ -155,12 +171,20 @@ def main():
...
@@ -155,12 +171,20 @@ def main():
if
device_name
:
if
device_name
:
if
device_name
in
inst
.
block_device_mapping
:
if
device_name
in
inst
.
block_device_mapping
:
module
.
exit_json
(
msg
=
"Volume mapping for
%
s already exists on instance
%
s"
%
(
device_name
,
instance
),
module
.
exit_json
(
msg
=
"Volume mapping for
%
s already exists on instance
%
s"
%
(
device_name
,
instance
),
changed
=
False
)
changed
=
False
)
# If custom iops is defined we use volume_type "io1" rather than the default of "standard"
if
iops
:
volume_type
=
'io1'
else
:
volume_type
=
'standard'
# If no instance supplied, try volume creation based on module parameters.
# If no instance supplied, try volume creation based on module parameters.
try
:
try
:
volume
=
ec2
.
create_volume
(
volume_size
,
zone
)
volume
=
ec2
.
create_volume
(
volume_size
,
zone
,
None
,
volume_type
,
iops
)
while
volume
.
status
!=
'available'
:
while
volume
.
status
!=
'available'
:
time
.
sleep
(
3
)
time
.
sleep
(
3
)
volume
.
update
()
volume
.
update
()
...
...
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