diff --git a/lib/ansible/modules/cloud/amazon/ec2_lc.py b/lib/ansible/modules/cloud/amazon/ec2_lc.py index dcd0d61883..9610d48eb4 100755 --- a/lib/ansible/modules/cloud/amazon/ec2_lc.py +++ b/lib/ansible/modules/cloud/amazon/ec2_lc.py @@ -172,6 +172,17 @@ EXAMPLES = ''' iops: 3000 delete_on_termination: true +# create a launch configuration to omit the /dev/sdf EBS device that is included in the AMI image + +- ec2_lc: + name: special + image_id: ami-XXX + key_name: default + security_groups: ['group', 'group2' ] + instance_type: t1.micro + volumes: + - device_name: /dev/sdf + no_device: true ''' RETURN = ''' @@ -396,7 +407,7 @@ def create_block_device_meta(module, volume): if 'device_type' in volume: volume['volume_type'] = volume.pop('device_type') - if 'snapshot' not in volume and 'ephemeral' not in volume: + if 'snapshot' not in volume and 'ephemeral' not in volume and 'no_device' not in volume: if 'volume_size' not in volume: module.fail_json(msg='Size must be specified when creating a new volume or modifying the root volume') if 'snapshot' in volume: @@ -414,7 +425,7 @@ def create_block_device_meta(module, volume): if 'device_name' in volume: return_object['DeviceName'] = volume.get('device_name') - if 'no_device' is volume: + if 'no_device' in volume: return_object['NoDevice'] = volume.get('no_device') if any(key in volume for key in ['snapshot', 'volume_size', 'volume_type', 'delete_on_termination', 'ips', 'encrypted']):