Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ec2 vol improvements #2580

Merged
merged 2 commits into from
Apr 16, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions library/ec2_vol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ DOCUMENTATION = '''
module: ec2_vol
short_description: create and attach a volume, return volume id and device map
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"
options:
instance:
Expand All @@ -36,7 +36,7 @@ options:
aliases: []
device_name:
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
default: null
aliases: []
Expand Down Expand Up @@ -123,6 +123,12 @@ def main():
inst = reservation[0].instances[0]
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.

try:
Expand Down