Can't display Tag Names for hosts in AWX ec2 dynamic source inventory

,

Hi all,

I have my aws_ec2 iventory config with the bellow setting:

inventory/infra_aws_ec2.yml
hostnames:

  • tag:Name

When I run ansible-inventory I get the desired result, the ec2 instances are displayed with their Name tags:

ansible-inventory -i inventory/infra_aws_ec2.yml --graph

@all:

@aws_ec2:

–server001.example.com
@aws_region_eu_west_1:
–server001.example.com
@tag_Name_server001_example_com:
–server001.example.com
@ungrouped:

In Ansible AWS, under the dynamic inventory source variables, the above setting is not working, I get the imported list of the ec2 instances with their private DNS instead of Name tags…

Can you please advise?

I was able to make it work by setting the bellow in the Dynamic Inventory :

Source Variables:


hostname_variable: 'tag:Name'