Skip to content
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

support ec2 metadata uri options #2364

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

Conversation

hitsumabushi
Copy link

SUMMARY

This PR provide the feature to customize the URIs related to IMDS.
The feature helps user who want to develop and test playbooks on local or outside of AWS, but will deploy on AWS.
We can mock IMDS easily by this PR.

The way to customize URIs of IMDS seems to have interfaces on the class level, but not expose on ansible module level.
In this PR, I just create the way to customize options without any refactoring.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

ec2_metadata_facts

ADDITIONAL INFORMATION

Copy link

github-actions bot commented Oct 25, 2024

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/11626726233

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/ec2_metadata_facts_module.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/ec2_metadata_facts_module.html b/home/runner/work/amazon.aws/amazon.aws/docsbuild/head/collections/amazon/aws/ec2_metadata_facts_module.html
index 3060828..1739eda 100644
--- a/home/runner/work/amazon.aws/amazon.aws/docsbuild/base/collections/amazon/aws/ec2_metadata_facts_module.html
+++ b/home/runner/work/amazon.aws/amazon.aws/docsbuild/head/collections/amazon/aws/ec2_metadata_facts_module.html
@@ -174,6 +174,60 @@ To check whether it is installed, run <code class="code docutils literal notrans
 </thead>
 <tbody>
 <tr class="row-even"><td><div class="ansible-option-cell">
+<div class="ansibleOptionAnchor" id="parameter-ec2_dynamicdata_uri"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-metadata-facts-module-parameter-ec2-dynamicdata-uri"><strong>ec2_dynamicdata_uri</strong></p>
+<a class="ansibleOptionLink" href="#parameter-ec2_dynamicdata_uri" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
+<p><em class="ansible-option-versionadded">added in amazon.aws 8.3.0</em></p>
+</div></td>
+<td><div class="ansible-option-cell"><p>This option is for testing purpuse.</p>
+<p>If not specified, <code class="ansible-value docutils literal notranslate"><span class="pre">http://169.254.169.254/latest/dynamic/</span></code> is used.</p>
+</div></td>
+</tr>
+<tr class="row-odd"><td><div class="ansible-option-cell">
+<div class="ansibleOptionAnchor" id="parameter-ec2_metadata_instance_tags_uri"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-metadata-facts-module-parameter-ec2-metadata-instance-tags-uri"><strong>ec2_metadata_instance_tags_uri</strong></p>
+<a class="ansibleOptionLink" href="#parameter-ec2_metadata_instance_tags_uri" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
+<p><em class="ansible-option-versionadded">added in amazon.aws 8.3.0</em></p>
+</div></td>
+<td><div class="ansible-option-cell"><p>This option is for testing purpuse.</p>
+<p>If not specified, <code class="ansible-value docutils literal notranslate"><span class="pre">http://169.254.169.254/latest/meta-data/tags/instance</span></code> is used.</p>
+</div></td>
+</tr>
+<tr class="row-even"><td><div class="ansible-option-cell">
+<div class="ansibleOptionAnchor" id="parameter-ec2_metadata_token_uri"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-metadata-facts-module-parameter-ec2-metadata-token-uri"><strong>ec2_metadata_token_uri</strong></p>
+<a class="ansibleOptionLink" href="#parameter-ec2_metadata_token_uri" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
+<p><em class="ansible-option-versionadded">added in amazon.aws 8.3.0</em></p>
+</div></td>
+<td><div class="ansible-option-cell"><p>This option is for testing purpuse.</p>
+<p>If not specified, <code class="ansible-value docutils literal notranslate"><span class="pre">http://169.254.169.254/latest/api/token</span></code> is used.</p>
+</div></td>
+</tr>
+<tr class="row-odd"><td><div class="ansible-option-cell">
+<div class="ansibleOptionAnchor" id="parameter-ec2_metadata_uri"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-metadata-facts-module-parameter-ec2-metadata-uri"><strong>ec2_metadata_uri</strong></p>
+<a class="ansibleOptionLink" href="#parameter-ec2_metadata_uri" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
+<p><em class="ansible-option-versionadded">added in amazon.aws 8.3.0</em></p>
+</div></td>
+<td><div class="ansible-option-cell"><p>This option is for testing purpuse.</p>
+<p>If not specified, <code class="ansible-value docutils literal notranslate"><span class="pre">http://169.254.169.254/latest/meta-data/</span></code> is used.</p>
+</div></td>
+</tr>
+<tr class="row-even"><td><div class="ansible-option-cell">
+<div class="ansibleOptionAnchor" id="parameter-ec2_sshdata_uri"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-metadata-facts-module-parameter-ec2-sshdata-uri"><strong>ec2_sshdata_uri</strong></p>
+<a class="ansibleOptionLink" href="#parameter-ec2_sshdata_uri" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
+<p><em class="ansible-option-versionadded">added in amazon.aws 8.3.0</em></p>
+</div></td>
+<td><div class="ansible-option-cell"><p>This option is for testing purpuse.</p>
+<p>If not specified, <code class="ansible-value docutils literal notranslate"><span class="pre">http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key</span></code> is used.</p>
+</div></td>
+</tr>
+<tr class="row-odd"><td><div class="ansible-option-cell">
+<div class="ansibleOptionAnchor" id="parameter-ec2_userdata_uri"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-metadata-facts-module-parameter-ec2-userdata-uri"><strong>ec2_userdata_uri</strong></p>
+<a class="ansibleOptionLink" href="#parameter-ec2_userdata_uri" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
+<p><em class="ansible-option-versionadded">added in amazon.aws 8.3.0</em></p>
+</div></td>
+<td><div class="ansible-option-cell"><p>This option is for testing purpuse.</p>
+<p>If not specified, <code class="ansible-value docutils literal notranslate"><span class="pre">http://169.254.169.254/latest/user-data/</span></code> is used.</p>
+</div></td>
+</tr>
+<tr class="row-even"><td><div class="ansible-option-cell">
 <div class="ansibleOptionAnchor" id="parameter-metadata_token_ttl_seconds"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-ec2-metadata-facts-module-parameter-metadata-token-ttl-seconds"><strong>metadata_token_ttl_seconds</strong></p>
 <a class="ansibleOptionLink" href="#parameter-metadata_token_ttl_seconds" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">integer</span></p>
 <p><em class="ansible-option-versionadded">added in amazon.aws 8.2.0</em></p>

Copy link
Contributor

Build failed.
https://ansible.softwarefactory-project.io/zuul/buildset/7f278ddaa0cb4a2abe0bfbe3160fd417

✔️ ansible-galaxy-importer SUCCESS in 4m 27s
✔️ build-ansible-collection SUCCESS in 10m 17s
✔️ ansible-test-splitter SUCCESS in 3m 56s
integration-amazon.aws-1 FAILURE in 51m 25s
Skipped 43 jobs

@hitsumabushi
Copy link
Author

hitsumabushi commented Oct 26, 2024

I couldn't find the cause of the failure from the console log.

@hitsumabushi
Copy link
Author

recheck

Copy link
Contributor

Build failed.
https://ansible.softwarefactory-project.io/zuul/buildset/fff40f058ed14b09a4a3e237898df987

✔️ ansible-galaxy-importer SUCCESS in 5m 10s
✔️ build-ansible-collection SUCCESS in 9m 56s
✔️ ansible-test-splitter SUCCESS in 3m 54s
integration-amazon.aws-1 FAILURE in 12m 51s
Skipped 43 jobs

@hitsumabushi
Copy link
Author

I found some unreachable=1 and Permission denied (publickey,gssapi-keyex,gssapi-with-mic)
Does someone know how to fix it?

Copy link
Contributor

Build failed.
https://ansible.softwarefactory-project.io/zuul/buildset/70d7ff7b0e7d46fb96321eeafdfed1e6

✔️ ansible-galaxy-importer SUCCESS in 5m 10s
✔️ build-ansible-collection SUCCESS in 10m 30s
✔️ ansible-test-splitter SUCCESS in 4m 12s
integration-amazon.aws-1 FAILURE in 50m 32s
Skipped 43 jobs

Copy link
Contributor

Build failed.
https://ansible.softwarefactory-project.io/zuul/buildset/c303fe23749047a8bc1063cebe1192f6

✔️ ansible-galaxy-importer SUCCESS in 4m 45s
✔️ build-ansible-collection SUCCESS in 10m 11s
✔️ ansible-test-splitter SUCCESS in 3m 51s
integration-amazon.aws-1 FAILURE in 52m 27s
Skipped 43 jobs

Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/825e2bf291744269add3d62da058dec8

✔️ ansible-galaxy-importer SUCCESS in 5m 11s
✔️ build-ansible-collection SUCCESS in 10m 23s
✔️ ansible-test-splitter SUCCESS in 4m 00s
✔️ integration-amazon.aws-1 SUCCESS in 10m 29s
Skipped 43 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.

1 participant