pass iam_role_arn through to aws inv. plugin

This commit is contained in:
Jim Ladd
2020-02-24 16:03:49 -08:00
committed by AlanCoding
parent 8a20b5225b
commit 96c6cf9f05
3 changed files with 6 additions and 1 deletions

View File

@@ -2027,6 +2027,9 @@ class ec2(PluginFileInjector):
grouping_data['key'] += ' | regex_replace("{rx}", "_")'.format(rx=legacy_regex) grouping_data['key'] += ' | regex_replace("{rx}", "_")'.format(rx=legacy_regex)
# end compatibility content # end compatibility content
if source_vars.get('iam_role_arn', None):
ret['iam_role_arn'] = source_vars['iam_role_arn']
# This was an allowed ec2.ini option, also plugin option, so pass through # This was an allowed ec2.ini option, also plugin option, so pass through
if source_vars.get('boto_profile', None): if source_vars.get('boto_profile', None):
ret['boto_profile'] = source_vars['boto_profile'] ret['boto_profile'] = source_vars['boto_profile']

View File

@@ -1,4 +1,5 @@
boto_profile: /tmp/my_boto_stuff boto_profile: /tmp/my_boto_stuff
iam_role_arn: arn:aws:iam::123456789012:role/test-role
compose: compose:
ansible_host: public_ip_address ansible_host: public_ip_address
ec2_account_id: owner_id ec2_account_id: owner_id

View File

@@ -38,7 +38,8 @@ TEST_SOURCE_FIELDS = {
INI_TEST_VARS = { INI_TEST_VARS = {
'ec2': { 'ec2': {
'boto_profile': '/tmp/my_boto_stuff' 'boto_profile': '/tmp/my_boto_stuff',
'iam_role_arn': 'arn:aws:iam::123456789012:role/test-role'
}, },
'gce': {}, 'gce': {},
'openstack': { 'openstack': {