From 9ec103e748ef23f1bbb7634ffebc817fd3e8def7 Mon Sep 17 00:00:00 2001 From: Lester Wade Date: Tue, 16 Jul 2013 13:31:30 +0100 Subject: [PATCH] Added IAM role support --- library/cloud/ec2 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/library/cloud/ec2 b/library/cloud/ec2 index e3118ec380..a7320689b1 100644 --- a/library/cloud/ec2 +++ b/library/cloud/ec2 @@ -163,6 +163,13 @@ options: required: false defualt: null aliases: [] + instance_profile_name: + version_added: "1.3" + description: + - Name of the IAM instance profile to use + required: false + default: null + aliases: [] instance_ids: version_added: "1.3" description: @@ -178,7 +185,6 @@ options: default: 'present' aliases: [] - requirements: [ "boto" ] author: Seth Vidal, Tim Gerla, Lester Wade ''' @@ -345,6 +351,7 @@ def create_instances(module, ec2): instance_tags = module.params.get('instance_tags') vpc_subnet_id = module.params.get('vpc_subnet_id') private_ip = module.params.get('private_ip') + instance_profile_name = module.params.get('instance_profile_name') # Here we try to lookup the group name from the security group id - if group_id is set. @@ -401,7 +408,8 @@ def create_instances(module, ec2): 'ramdisk_id': ramdisk, 'subnet_id': vpc_subnet_id, 'private_ip_address': private_ip, - 'user_data': user_data} + 'user_data': user_data, + 'instance_profile_name': instance_profile_name} if vpc_subnet_id: params['security_group_ids'] = group_id @@ -521,6 +529,7 @@ def main(): instance_tags = dict(), vpc_subnet_id = dict(), private_ip = dict(), + instance_profile_name = dict(), instance_ids = dict(type='list'), state = dict(default='present'), )