From 124b3dce50e6f9e608b2cf4a67156fdd8a442e68 Mon Sep 17 00:00:00 2001 From: awkspace Date: Thu, 26 Oct 2017 19:08:57 -0400 Subject: [PATCH] Fix ec2_lc failing to create multi-volume configurations (#32191) --- lib/ansible/modules/cloud/amazon/ec2_lc.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) mode change 100644 => 100755 lib/ansible/modules/cloud/amazon/ec2_lc.py diff --git a/lib/ansible/modules/cloud/amazon/ec2_lc.py b/lib/ansible/modules/cloud/amazon/ec2_lc.py old mode 100644 new mode 100755 index 27e94d9a2e..4347840637 --- a/lib/ansible/modules/cloud/amazon/ec2_lc.py +++ b/lib/ansible/modules/cloud/amazon/ec2_lc.py @@ -254,7 +254,7 @@ def create_launch_config(connection, module): classic_link_vpc_id = module.params.get('classic_link_vpc_id') classic_link_vpc_security_groups = module.params.get('classic_link_vpc_security_groups') - block_device_mapping = {} + block_device_mapping = [] convert_list = ['image_id', 'instance_type', 'instance_type', 'instance_id', 'placement_tenancy', 'key_name', 'kernel_id', 'ramdisk_id', 'spot_price'] @@ -273,7 +273,7 @@ def create_launch_config(connection, module): module.fail_json(msg='Device name must be set for volume') # Minimum volume size is 1GB. We'll use volume size explicitly set to 0 to be a signal not to create this volume if 'volume_size' not in volume or int(volume['volume_size']) > 0: - block_device_mapping.update(create_block_device_meta(module, volume)) + block_device_mapping.append(create_block_device_meta(module, volume)) try: launch_configs = connection.describe_launch_configurations(LaunchConfigurationNames=[name]).get('LaunchConfigurations') @@ -298,7 +298,7 @@ def create_launch_config(connection, module): launch_config['ClassicLinkVPCSecurityGroups'] = classic_link_vpc_security_groups if block_device_mapping: - launch_config['BlockDeviceMappings'] = [block_device_mapping] + launch_config['BlockDeviceMappings'] = block_device_mapping if instance_profile_name is not None: launch_config['IamInstanceProfile'] = instance_profile_name