Open blerrgh opened 1 year ago
Files identified in the description:
plugins/inventory/aws_ec2.py
](https://github.com/['ansible-collections/amazon.aws', 'ansible-collections/community.aws', 'ansible-collections/community.vmware']/blob/main/plugins/inventory/aws_ec2.py)If these files are inaccurate, please update the component name
section of the description or use the !component
bot command.
Summary
Using the hostnames property can sometimes result in hosts with spaces. For example:
If an EC2 instance is named "Space In Name", the returned host will match:
Unfortunately, hostnames with spaces aren't supported, so it becomes impossible to select those hosts on the command line, i.e. with --limit (see: https://github.com/ansible/ansible/issues/14513)
Issue Type
Bug Report
Component Name
aws_ec2 inventory
Ansible Version
Collection Versions
AWS SDK versions
Configuration
OS / Environment
Ubuntu 22.04.2 LTS jammy
Steps to Reproduce
with an EC2 instance which has a Name that includes a space.
I tried using
{{ tag:Name | replace(' ','_') }}
as well, but jinja does not get evaluated in thehostnames:
section.Expected Results
Ideally, usable hostnames would be generated, probably by auto-converting spaces to underscores.
Actual Results
Spaces were included in the hostnames rendering them unusable from the command line.
Code of Conduct