Merge pull request #2580 from blair/ec2_vol-improvements
Ec2 vol improvements
This commit is contained in:
commit
55828d14da
1 changed files with 8 additions and 2 deletions
10
ec2_vol
10
ec2_vol
|
@ -19,7 +19,7 @@ DOCUMENTATION = '''
|
||||||
module: ec2_vol
|
module: ec2_vol
|
||||||
short_description: create and attach a volume, return volume id and device map
|
short_description: create and attach a volume, return volume id and device map
|
||||||
description:
|
description:
|
||||||
- creates an EBS volume and optionally attaches it to an instance. This module has a dependency on python-boto
|
- creates an EBS volume and optionally attaches it to an instance. If both an instance ID and a device name is given and the instance has a device at the device name, then no volume is created and no attachment is made. This module has a dependency on python-boto.
|
||||||
version_added: "1.1"
|
version_added: "1.1"
|
||||||
options:
|
options:
|
||||||
instance:
|
instance:
|
||||||
|
@ -36,7 +36,7 @@ options:
|
||||||
aliases: []
|
aliases: []
|
||||||
device_name:
|
device_name:
|
||||||
description:
|
description:
|
||||||
- device id to override device mapping. Assumes /dev/sdf for instance-store, /dev/sdb for EBS.
|
- device id to override device mapping. Assumes /dev/sdf for Linux/UNIX and /dev/xvdf for Windows.
|
||||||
required: false
|
required: false
|
||||||
default: null
|
default: null
|
||||||
aliases: []
|
aliases: []
|
||||||
|
@ -123,6 +123,12 @@ def main():
|
||||||
inst = reservation[0].instances[0]
|
inst = reservation[0].instances[0]
|
||||||
zone = inst.placement
|
zone = inst.placement
|
||||||
|
|
||||||
|
# Check if there is a volume already mounted there.
|
||||||
|
if device_name:
|
||||||
|
if device_name in inst.block_device_mapping:
|
||||||
|
module.exit_json(msg="Volume mapping for %s already exists on instance %s" % (device_name, instance),
|
||||||
|
changed=False)
|
||||||
|
|
||||||
# If no instance supplied, try volume creation based on module parameters.
|
# If no instance supplied, try volume creation based on module parameters.
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Reference in a new issue