Skip to content

Fix: Improve aws_ssm documentation examples #2661

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Nklya
Copy link

@Nklya Nklya commented Jun 9, 2025

SUMMARY

I noticed that unlike aws_ec2 docs, aws_ssm connection plugin documentation doesn't mention ability to use compose to show one hostname, but connect to instance_id.

I think it would be useful to add this.

Fixes: #2652

ISSUE TYPE
  • Docs Pull Request
COMPONENT NAME
ADDITIONAL INFORMATION

None

Copy link

github-actions bot commented Jun 9, 2025

Docs Build 📝

Thank you for contribution!✨

The docsite for this PR is available for download as an artifact from this run:
https://github.com/ansible-collections/amazon.aws/actions/runs/15555084681

You can compare to the docs for the main branch here:
https://ansible-collections.github.io/amazon.aws/branch/main

File changes:

  • M collections/amazon/aws/aws_ssm_connection.html
Click to see the diff comparison.

NOTE: only file modifications are shown here. New and deleted files are excluded.
See the file list and check the published docs to see those files.

diff --git a/home/runner/work/amazon.aws/amazon.aws/docsbuild/base/collections/amazon/aws/aws_ssm_connection.html b/home/runner/work/amazon.aws/amazon.aws/docsbuild/head/collections/amazon/aws/aws_ssm_connection.html
index e4eadd1..7de2b5b 100644
--- a/home/runner/work/amazon.aws/amazon.aws/docsbuild/base/collections/amazon/aws/aws_ssm_connection.html
+++ b/home/runner/work/amazon.aws/amazon.aws/docsbuild/head/collections/amazon/aws/aws_ssm_connection.html
@@ -481,9 +481,20 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-aws-ssm-
 <span class="w">      </span><span class="nt">raw</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">yum install -y awscli</span>
 <span class="w">      </span><span class="nt">tags</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">aws-cli</span>
 
+<span class="c1"># Alternatively, you can use a tag (eg. Name) as hostname instead of InstanceID.</span>
+<span class="c1"># However,  &quot;ansible_host&quot; must still be set to the instance_id</span>
+<span class="c1"># =======================================</span>
+<span class="c1"># # aws_ec2.yml (Dynamic Inventory - Linux)</span>
+<span class="c1"># plugin: aws_ec2</span>
+<span class="c1"># regions:</span>
+<span class="c1">#   - us-east-1</span>
+<span class="c1"># hostnames:</span>
+<span class="c1">#   - tag:Name # will return `tag:Name` for hostname</span>
+<span class="c1"># compose:</span>
+<span class="c1">#   ansible_host: instance_id # but connection will be done to InstanceID</span>
 <span class="nn">---</span>
 
-<span class="c1"># Execution: ansible-playbook linux.yaml -i aws_ec2.yml</span>
+<span class="c1"># Execution: ansible-playbook windows.yaml -i aws_ec2.yml</span>
 <span class="c1"># =====================================================</span>
 <span class="c1"># # aws_ec2.yml (Dynamic Inventory - Windows)</span>
 <span class="c1"># plugin: aws_ec2</span>

Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/038e851986ad4425ac224e901cee83d7

✔️ ansible-galaxy-importer SUCCESS in 3m 51s
✔️ build-ansible-collection SUCCESS in 11m 13s
✔️ ansible-test-splitter SUCCESS in 4m 10s
✔️ integration-amazon.aws-1 SUCCESS in 20m 23s
✔️ integration-amazon.aws-2 SUCCESS in 13m 05s
✔️ integration-amazon.aws-3 SUCCESS in 13m 54s
✔️ integration-amazon.aws-4 SUCCESS in 13m 58s
✔️ integration-amazon.aws-5 SUCCESS in 14m 08s
✔️ integration-amazon.aws-6 SUCCESS in 13m 58s
✔️ integration-amazon.aws-7 SUCCESS in 13m 10s
✔️ integration-amazon.aws-8 SUCCESS in 12m 47s
✔️ integration-amazon.aws-9 SUCCESS in 13m 23s
✔️ integration-amazon.aws-10 SUCCESS in 5m 05s
✔️ integration-amazon.aws-11 SUCCESS in 13m 15s
Skipped 33 jobs

Copy link
Contributor

@tremble tremble left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, given that if you tweak hostnames, then ansible_host needs to be set I think this is a helpful change.

Suggested some tweaks to the wording.

@Nklya
Copy link
Author

Nklya commented Jun 10, 2025

Thank you for review and suggestions, committed them.

Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/8db56d9859444a01abdb086300a6b3d6

✔️ ansible-galaxy-importer SUCCESS in 3m 37s
✔️ build-ansible-collection SUCCESS in 11m 20s
✔️ ansible-test-splitter SUCCESS in 4m 19s
✔️ integration-amazon.aws-1 SUCCESS in 21m 09s
✔️ integration-amazon.aws-2 SUCCESS in 14m 45s
✔️ integration-amazon.aws-3 SUCCESS in 17m 33s
✔️ integration-amazon.aws-4 SUCCESS in 14m 19s
✔️ integration-amazon.aws-5 SUCCESS in 25m 38s
✔️ integration-amazon.aws-6 SUCCESS in 13m 24s
✔️ integration-amazon.aws-7 SUCCESS in 17m 15s
✔️ integration-amazon.aws-8 SUCCESS in 14m 54s
✔️ integration-amazon.aws-9 SUCCESS in 17m 33s
✔️ integration-amazon.aws-10 SUCCESS in 4m 41s
✔️ integration-amazon.aws-11 SUCCESS in 13m 12s
Skipped 33 jobs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for aws_ssm custom tag->InstanceId mapping
2 participants