Skip to content

Support for aws_ssm custom tag->InstanceId mapping #2652

Closed
@nantiferov

Description

@nantiferov

Summary

I'm not 100% sure if this achievable or maybe I missed something in docs, but I think would be great to be able to use some tag, for example tag:Name instead of InstanceId with ansible_connection: aws_ssm.

I.e. InstanceId is still used by ansible to connect via SSM Agent, but ansible supports limit by and shows tag:Name in the logs, example:

# Instead of plain InstanceId
$ ansible-playbook test.yaml --limit i-xxxxxxxxx # optional limit

PLAY [i-xxxxxxxxx] ****************************************************************

GATHERING FACTS ***************************************************************
ok: [i-xxxxxxxxx]
...

# support this
$ ansible-playbook test.yaml --limit some-test-host # optional limit, will be translated automatically to InstanceId

PLAY [some-test-host(i-xxxxxxxxx)] ****************************************************************

GATHERING FACTS ***************************************************************
ok: [some-test-host(i-xxxxxxxxx)]
...

I believe aws_ec2 dynamic inventory has all required information, i.e. Tags. In case of misconfiguration, when there are duplicated tags, module should fail I think.

Issue Type

Feature Idea

Component Name

aws_ssm ansible_connection

Additional Information

ansible_connection: aws_ssm
ansible_aws_ssm_tag: Name # to enable automatic translation from `tag:Name` -> InstanceId

Code of Conduct

  • I agree to follow the Ansible Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureThis issue/PR relates to a feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions