Allow disabling of the deprecated tags host variable in the AWS EC2 inventory plugin - #3030
Allow disabling of the deprecated tags host variable in the AWS EC2 inventory plugin#3030oraNod wants to merge 8 commits into
tags host variable in the AWS EC2 inventory plugin#3030Conversation
Docs Build 📝Thank you for contribution!✨ The docsite for this PR is available for download as an artifact from this run: You can compare to the docs for the File changes:
Click to see the diff comparison.NOTE: only file modifications are shown here. New and deleted files are excluded. diff --git a/home/runner/work/amazon.aws/amazon.aws/docsbuild/base/collections/amazon/aws/aws_ec2_inventory.html b/home/runner/work/amazon.aws/amazon.aws/docsbuild/head/collections/amazon/aws/aws_ec2_inventory.html
index 50237b9..7f1f19b 100644
--- a/home/runner/work/amazon.aws/amazon.aws/docsbuild/base/collections/amazon/aws/aws_ec2_inventory.html
+++ b/home/runner/work/amazon.aws/amazon.aws/docsbuild/head/collections/amazon/aws/aws_ec2_inventory.html
@@ -691,6 +691,21 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-aws-ec2-
</div></td>
</tr>
<tr class="row-even"><td><div class="ansible-option-cell">
+<div class="ansibleOptionAnchor" id="parameter-use_deprecated_tags"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-aws-ec2-inventory-parameter-use-deprecated-tags"><strong>use_deprecated_tags</strong></p>
+<a class="ansibleOptionLink" href="#parameter-use_deprecated_tags" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
+<p><em class="ansible-option-versionadded">added in amazon.aws 12.0.0</em></p>
+</div></td>
+<td><div class="ansible-option-cell"><p>Whether to include the deprecated <code class="docutils literal notranslate"><span class="pre">tags</span></code> host variable alongside <code class="docutils literal notranslate"><span class="pre">ec2_tags</span></code>.</p>
+<p>Set to <code class="ansible-value docutils literal notranslate"><span class="pre">false</span></code> to stop the plugin from adding the <code class="docutils literal notranslate"><span class="pre">tags</span></code> host variable, which also disables this plugin’s <code class="docutils literal notranslate"><span class="pre">tags</span></code> deprecation warning and Ansible’s reserved variable name warning for <code class="docutils literal notranslate"><span class="pre">tags</span></code>.</p>
+<p>The use of this feature is deprecated and will be removed in a release after 2026-12-01. Use the <code class="docutils literal notranslate"><span class="pre">ec2_tags</span></code> structure instead.</p>
+<p class="ansible-option-line"><strong class="ansible-option-choices">Choices:</strong></p>
+<ul class="simple">
+<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">false</span></code></p></li>
+<li><p><code class="ansible-option-default-bold docutils literal notranslate"><strong><span class="pre">true</span></strong></code> <span class="ansible-option-choices-default-mark">← (default)</span></p></li>
+</ul>
+</div></td>
+</tr>
+<tr class="row-odd"><td><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-use_extra_vars"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-aws-ec2-inventory-parameter-use-extra-vars"><strong>use_extra_vars</strong></p>
<a class="ansibleOptionLink" href="#parameter-use_extra_vars" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
<p><em class="ansible-option-versionadded">added in ansible-core 2.11</em></p>
@@ -713,7 +728,7 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-aws-ec2-
</ul>
</div></td>
</tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
+<tr class="row-even"><td><div class="ansible-option-cell">
<div class="ansibleOptionAnchor" id="parameter-use_ssm_inventory"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-aws-ec2-inventory-parameter-use-ssm-inventory"><strong>use_ssm_inventory</strong></p>
<a class="ansibleOptionLink" href="#parameter-use_ssm_inventory" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
<p><em class="ansible-option-versionadded">added in amazon.aws 6.0.0</em></p>
@@ -743,7 +758,7 @@ For example, an ansible.cfg entry (further up in the list) is overwritten by an
<p class="admonition-title">Note</p>
<ul class="simple">
<li><p>If no credentials are provided and the control node has an associated IAM instance profile then the role will be used for authentication.</p></li>
-<li><p>The <code class="docutils literal notranslate"><span class="pre">tags</span></code> host variable is deprecated and will be removed in a release after 2026-12-01. Use <code class="docutils literal notranslate"><span class="pre">ec2_tags</span></code> instead to avoid conflicts with Ansible reserved variable names.</p></li>
+<li><p>The <code class="docutils literal notranslate"><span class="pre">tags</span></code> host variable is deprecated and will be removed in a release after 2026-12-01. Use <code class="docutils literal notranslate"><span class="pre">ec2_tags</span></code> instead to avoid conflicts with Ansible reserved variable names. Set <code class="ansible-option-value docutils literal notranslate"><a class="reference internal" href="#ansible-collections-amazon-aws-aws-ec2-inventory-parameter-use-deprecated-tags"><span class="std std-ref"><span class="pre">use_deprecated_tags=false</span></span></a></code> to disable the <code class="docutils literal notranslate"><span class="pre">tags</span></code> host variable, and this warning, before then.</p></li>
<li><p>The <code class="docutils literal notranslate"><span class="pre">ec2_tags</span></code> host variable was added in version 11.2.0.</p></li>
<li><p>The <code class="docutils literal notranslate"><span class="pre">use_contrib_script_compatible_ec2_tag_keys</span></code> option is deprecated and will be removed in a release after 2026-12-01. Use the <code class="docutils literal notranslate"><span class="pre">ec2_tags</span></code> structure instead (e.g. use <code class="docutils literal notranslate"><span class="pre">ec2_tags.TAGNAME</span></code> rather than <code class="docutils literal notranslate"><span class="pre">ec2_tag_TAGNAME</span></code>).</p></li>
<li><p>The <code class="docutils literal notranslate"><span class="pre">use_contrib_script_compatible_sanitization</span></code> option is deprecated and will be removed in a release after 2026-12-01. Use Ansible’s default group name sanitization instead.</p></li>
|
|
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 3m 45s |
|
| inventory._add_ssm_information(connection, instances) | ||
| assert expected == instances | ||
|
|
||
| assert 2 == m_get_ssm_information.call_count |
There was a problem hiding this comment.
SonarCloud is complaining about the order of these two.
It expects actual_value == expected_value.
I think we ignore this for now. Some people prefer it this way around because 2 = call_count will result in an error if you make the mistake of single =. I don't think it's worth poking right now and certainly not for this PR.
| - Set to V(false) to stop the plugin from adding the C(tags) host variable, which also | ||
| disables this plugin's C(tags) deprecation warning and Ansible's reserved variable | ||
| name warning for C(tags). | ||
| - The use of this feature is deprecated and will be removed in a release after 2026-12-01. |
There was a problem hiding this comment.
@alinabuzachis @GomathiselviS When are you currently planning for 12.0.0 release? If we're aiming for early November, then we could swap the release dates for versions, and the wording becomes a little less clunky.
| - The use of this feature is deprecated and will be removed in a release after 2026-12-01. | |
| - This parameter will be ignored when the deprecated C(tags) host variable is removed | |
| (in a release after 2026-12-01). |
If we remove this in 2026-12-01 there's no way to ensure consistent behaviour between 12.0.0 and 13.0.0.
Setting this flag to False will trigger the new behaviour in 12.0.0, but cause failures in 13.0.0. This causes problems for people who need to run a mixed environment (and is an example of why we normally use a 2 year deprecation cycle)
What we've done in the past is add a 2 year deprecation to the feature flag after ignoring it. This means that people can turn off the deprecated feature in advance. Make sure everything's working. They can then run both 12 and 13 while they migrate to 13, followed by dropping the parameter once they finish their migrations. It's a smoother path and doesn't result in multiple breakages.
There was a problem hiding this comment.
Thanks for this @tremble I wasn't sure at all tbh, based this on similar bits, and made some assumptions. I agree that a 2 year deprecation would be a smoother path but will wait for @alinabuzachis and @GomathiselviS
| Use the C(ec2_tags) structure instead. | ||
| type: bool | ||
| default: true | ||
| version_added: 12.0.0 |
There was a problem hiding this comment.
Any reason not to back port this to 11?
There was a problem hiding this comment.
No reason that I'm aware of. I still need to learn the release process and versions around here.
There was a problem hiding this comment.
In general main is "future" (the major we've not released yet, currently 12.0.0). Most non-breaking changes get backported into the "current" stable-X branch (stable-11 at the minute), bugfixes to both the current and the previous stable (stable-11 and stable-10) branch, and security fixes sometimes get pulled back even further.
We have patchback configured and a workflow that reads the changelog fragment to estimate which releases it should be backported for (backport tags are added when mergeit is set)
The actual release process is also documented https://github.com/ansible-collections/amazon.aws/blob/main/docs/docsite/rst/collection_release.rst
We also have a workflow which keeps https://github.com/ansible-collections/amazon.aws/releases up to date.
Last release was 11.4.0, so if this is backported it would be 11.5.0.
Co-authored-by: Mark Chappell <mchappel@redhat.com>
Co-authored-by: Mark Chappell <mchappel@redhat.com>
Co-authored-by: Mark Chappell <mchappel@redhat.com>
9bf408a to
d585ac1
Compare
Co-authored-by: Mark Chappell <mchappel@redhat.com>
|
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 00s |
|
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 5m 05s |



SUMMARY
Resolves #3028
ISSUE TYPE
COMPONENT NAME
Note that the
plugins/inventory/aws_rds.pyplugin also likely needs the same treatment but I thought it might be better as a separate PR. I can do that as a follow up.