diff --git a/awx/main/models/inventory.py b/awx/main/models/inventory.py index ad1f4ddacc..1c66c2eddc 100644 --- a/awx/main/models/inventory.py +++ b/awx/main/models/inventory.py @@ -2027,6 +2027,9 @@ class ec2(PluginFileInjector): grouping_data['key'] += ' | regex_replace("{rx}", "_")'.format(rx=legacy_regex) # 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 if source_vars.get('boto_profile', None): ret['boto_profile'] = source_vars['boto_profile'] diff --git a/awx/main/tests/data/inventory/plugins/ec2/files/aws_ec2.yml b/awx/main/tests/data/inventory/plugins/ec2/files/aws_ec2.yml index f214483dfd..a56f7a1ad0 100644 --- a/awx/main/tests/data/inventory/plugins/ec2/files/aws_ec2.yml +++ b/awx/main/tests/data/inventory/plugins/ec2/files/aws_ec2.yml @@ -1,4 +1,5 @@ boto_profile: /tmp/my_boto_stuff +iam_role_arn: arn:aws:iam::123456789012:role/test-role compose: ansible_host: public_ip_address ec2_account_id: owner_id diff --git a/awx/main/tests/functional/test_inventory_source_injectors.py b/awx/main/tests/functional/test_inventory_source_injectors.py index 277ebd3c3a..2557b158d6 100644 --- a/awx/main/tests/functional/test_inventory_source_injectors.py +++ b/awx/main/tests/functional/test_inventory_source_injectors.py @@ -38,7 +38,8 @@ TEST_SOURCE_FIELDS = { INI_TEST_VARS = { 'ec2': { - 'boto_profile': '/tmp/my_boto_stuff' + 'boto_profile': '/tmp/my_boto_stuff', + 'iam_role_arn': 'arn:aws:iam::123456789012:role/test-role' }, 'gce': {}, 'openstack': {