-
Notifications
You must be signed in to change notification settings - Fork 342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend ec2_metadata_facts to get instance tags #851
Comments
Files identified in the description:
If these files are inaccurate, please update the |
Yes, and community.aws supports this already for ec2_launch_template since 3.1.0 and amazon.aws for ec2_instance the support is already in the
Yes, +1 for the second option. Just a few words more about accessing metadata from the instances itself workaroundYou can do it already using ansible buildin modules - more or less comfortable - name: get metadata token
uri:
url: "http://169.254.169.254/latest/api/token"
headers:
X-aws-ec2-metadata-token-ttl-seconds: 60
method: PUT
return_content: yes
register: METADATA_TOKEN
- name: get tag name
uri:
url: "http://169.254.169.254/latest/meta-data/tags/instance/Name"
headers:
X-aws-ec2-metadata-token: "{{ METADATA_TOKEN.content }}"
return_content: yes
register: TAG_NAME prod and consThe ec2 instances that runs Another possibility to access all instance tags is via a control node that is using the dynamical aws_ec2 inventory. They are accessable via host_vars. |
+1, assume it's enabled, drop a warning if it fails, and continue cleanly. |
support was added by #1186 and should be available in release 5.1.0 |
aws_kms_info: Correct deprecation of keys_attr SUMMARY fixup derecation of keys_attr. ISSUE TYPE Feature Pull Request COMPONENT NAME aws_kms_info ADDITIONAL INFORMATION ansible-collections#838 Reviewed-by: Markus Bergholz <[email protected]> Reviewed-by: Jill R <None> Reviewed-by: None <None>
aws_kms_info: Correct deprecation of keys_attr SUMMARY fixup derecation of keys_attr. ISSUE TYPE Feature Pull Request COMPONENT NAME aws_kms_info ADDITIONAL INFORMATION ansible-collections#838 Reviewed-by: Markus Bergholz <[email protected]> Reviewed-by: Jill R <None> Reviewed-by: None <None>
aws_kms_info: Correct deprecation of keys_attr SUMMARY fixup derecation of keys_attr. ISSUE TYPE Feature Pull Request COMPONENT NAME aws_kms_info ADDITIONAL INFORMATION ansible-collections#838 Reviewed-by: Markus Bergholz <[email protected]> Reviewed-by: Jill R <None> Reviewed-by: None <None>
Summary
AWS recently added support for retrieving instance tags from the instance metadata service, see: https://aws.amazon.com/about-aws/whats-new/2022/01/instance-tags-amazon-ec2-instance-metadata-service/
A natural fit for including this functionality would be to extend ec2_metadata_facts to support retrieving instance tags, see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html#instance-metadata-ex-7 for details on how that is done.
I'd like to add the functionality, but I'm unclear what would be more acceptable to the community with regards to handling whether or not this functionality is enabled. There's two options I see:
OR
Which makes more sense and is in keeping with the "ethos" of the modules? My hunch is the 1st option.
Issue Type
Feature Idea
Component Name
ec2_metadata_facts.py
Additional Information
I'd be happy to write the code.
Code of Conduct
The text was updated successfully, but these errors were encountered: