# Cannot deprecate a collection plugin

**URL:** <https://forum.ansible.com/t/cannot-deprecate-a-collection-plugin/2751>\
**Category:** Get Help\
**Tags:** documentation, collections\
**Created:** [December 5, 2023, 2:48pm UTC](https://forum.ansible.com/t/cannot-deprecate-a-collection-plugin/2751 "2023-12-05T14:48:43Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![charlesrocket](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/charlesrocket/32/986_2.png) [@charlesrocket](https://forum.ansible.com/u/charlesrocket)\
**Post date:** [December 5, 2023, 2:48pm UTC](https://forum.ansible.com/t/cannot-deprecate-a-collection-plugin/2751/1 "2023-12-05T14:48:43Z")

</div>

I tried to deprecate a collection following current docs but sanity tests are red with Documentation.deprecated not agreeing: [fix: update plugin deprecation · charlesrocket/essential-collection@293a950 · GitHub](https://github.com/charlesrocket/essential-collection/commit/293a95082ea9d24cbd907a6a7d451e1c6f022eaf)

I wanted to deprecated on 1.4.0 but 2.0.0 also throwing Documentation.deprecated errors (not agreeing, extra fields).

According to docs I just need to change `modules` → `action` in the deprecated meta declaration and reflect it in plugin docs but:

```auto
ERROR: Found 2 validate-modules issue(s) which need to be resolved:
ERROR: plugins/modules/remote_vars.py:0:0: deprecation-mismatch: "meta/runtime.yml" and DOCUMENTATION.deprecation do not agree.
ERROR: plugins/modules/remote_vars.py:0:0: invalid-documentation: DOCUMENTATION.deprecated: extra keys not allowed @ data['deprecated']. Got {'removed_in': '1.4.0', 'alternative': 'Use M(charlesrocket.essential.fetch_vars) instead.', 'removed_from_collection': 'charlesrocket.essential'}

```

---

<div class="post-metadata">

**Author:** ![mariolenz](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/mariolenz/32/108_2.png) [@mariolenz](https://forum.ansible.com/u/mariolenz)\
**Post date:** [December 5, 2023, 3:36pm UTC](https://forum.ansible.com/t/cannot-deprecate-a-collection-plugin/2751/2 "2023-12-05T15:36:35Z")

</div>

It looks like there are two `remote_vars.py`. If you change `modules` → `action`, I guess you should add the deprecation to `plugins/action/remote_vars.py`.

If you really want to deprecate `plugins/modules/remote_vars.py`, then `modules` looks right to me.

I’m not sure, this is just an educated guess 😉

---

<div class="post-metadata">

**Author:** ![charlesrocket](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/charlesrocket/32/986_2.png) [@charlesrocket](https://forum.ansible.com/u/charlesrocket)\
**Post date:** [December 5, 2023, 10:34pm UTC](https://forum.ansible.com/t/cannot-deprecate-a-collection-plugin/2751/3 "2023-12-05T22:34:39Z")

</div>

One is the actual plugin and another is just docs and is the only place besides meta/ where I should place deprecation entries, according to docs [The lifecycle of an Ansible module or plugin — Ansible Documentation](https://docs.ansible.com/ansible/latest/dev_guide/module_lifecycle.html#deprecating-modules-and-plugins-in-a-collection)

the whole layout of action plugins is still a mystery to me)

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [December 6, 2023, 6:35am UTC](https://forum.ansible.com/t/cannot-deprecate-a-collection-plugin/2751/4 "2023-12-06T06:35:38Z")

</div>

You probably need to deprecate both the module file (which probably only contains docs in your case) and the action plugin in `meta/runtime.yml`.

---

<div class="post-metadata">

**Author:** ![charlesrocket](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/charlesrocket/32/986_2.png) [@charlesrocket](https://forum.ansible.com/u/charlesrocket)\
**Post date:** [December 6, 2023, 3:40pm UTC](https://forum.ansible.com/t/cannot-deprecate-a-collection-plugin/2751/5 "2023-12-06T15:40:47Z")

</div>

Wasn’t sure if I should merge into a single plugin file or deprecate docs as well (sounds silly) but I feel like I am getting somewhere with this double deprecation 😹

and once again, docs are clearly stating that `why` is **optional** :

```auto
ERROR: plugins/modules/remote_vars.py:0:0: invalid-documentation: DOCUMENTATION.deprecated.why: required key not provided @ data['deprecated']['why']. Got None

```

---

<div class="post-metadata">

**Author:** ![charlesrocket](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/charlesrocket/32/986_2.png) [@charlesrocket](https://forum.ansible.com/u/charlesrocket)\
**Post date:** [December 6, 2023, 3:55pm UTC](https://forum.ansible.com/t/cannot-deprecate-a-collection-plugin/2751/6 "2023-12-06T15:55:55Z")

</div>

Yep, duplicating deprecated meta entry got sanity tests green! Thanks

---

<div class="post-metadata">

**Author:** ![charlesrocket](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/charlesrocket/32/986_2.png) [@charlesrocket](https://forum.ansible.com/u/charlesrocket)\
**Post date:** [December 6, 2023, 10:36pm UTC](https://forum.ansible.com/t/cannot-deprecate-a-collection-plugin/2751/7 "2023-12-06T22:36:29Z")

</div>

I just got all tests green 🤯🤬🤯

```auto
/home/runner/work/essential-collection/essential-collection/docs/collections/charlesrocket/essential/remote_vars_module.rst:65: WARNING: undefined label: 'ansible_collections.charlesrocket.essential.fetch_vars_module'

```

this just makes zero sense. am i not able to put a role as an alternative to a module??? `fetch_vars` is a role: [charlesrocket.essential.fetch\_vars role – Includes variables from remote files — charlesrocket.essential Ansible collection documentation](https://charlesrocket.github.io/essential-collection/fetch_vars_role.html#ansible-collections-charlesrocket-essential-fetch-vars-role)

> <https://github.com/charlesrocket/essential-collection/actions/runs/7122175671/job/19392757980#step:9:1>

---

<div class="post-metadata">

**Author:** ![flowerysong](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/flowerysong/32/2305_2.png) [@flowerysong](https://forum.ansible.com/u/flowerysong)\
**Post date:** [December 7, 2023, 2:49am UTC](https://forum.ansible.com/t/cannot-deprecate-a-collection-plugin/2751/8 "2023-12-07T02:49:39Z")

</div>

Roles and modules fulfill very different needs so I wouldn’t be surprised if no one anticipated someone wanting to point to an alternative that was not of the same type.

---

<div class="post-metadata">

**Author:** ![charlesrocket](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/charlesrocket/32/986_2.png) [@charlesrocket](https://forum.ansible.com/u/charlesrocket)\
**Post date:** [December 7, 2023, 3:48am UTC](https://forum.ansible.com/t/cannot-deprecate-a-collection-plugin/2751/9 "2023-12-07T03:48:12Z")

</div>

The issue was `M(role)` in the module’s documentation. Tried with “R” when failed to find any docs on role deprecation — tests are green (?) but docsite outputs an error instead of the string. Going with the code attribute then 🤕

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [December 7, 2023, 6:22am UTC](https://forum.ansible.com/t/cannot-deprecate-a-collection-plugin/2751/10 "2023-12-07T06:22:09Z")

</div>

Well, `M(...)` refers to a module, so it’s not surprising that it complains if you put the name of a role in there 🙂 ([Module format and documentation — Ansible Documentation](https://docs.ansible.com/ansible/devel/dev_guide/developing_modules_documenting.html#linking-within-module-documentation))

Better use `P(...)`, which can reference modules, plugins, _and_ roles: `P(charlesrocket.essential.fetch_vars#role)`.

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [December 7, 2023, 6:35am UTC](https://forum.ansible.com/t/cannot-deprecate-a-collection-plugin/2751/11 "2023-12-07T06:35:20Z")

</div>

I created [Improve module developing documenation for deprecation and linking by felixfontein · Pull Request #943 · ansible/ansible-documentation · GitHub](https://github.com/ansible/ansible-documentation/pull/943) to improve the documentation with the issues mentioned above.

---

<div class="post-metadata">

**Author:** ![charlesrocket](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/charlesrocket/32/986_2.png) [@charlesrocket](https://forum.ansible.com/u/charlesrocket)\
**Post date:** [December 7, 2023, 2:28pm UTC](https://forum.ansible.com/t/cannot-deprecate-a-collection-plugin/2751/12 "2023-12-07T14:28:39Z")

</div>

Thanks! I’ve been looking for this one 😅

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [January 6, 2024, 2:28pm UTC](https://forum.ansible.com/t/cannot-deprecate-a-collection-plugin/2751/13 "2024-01-06T14:28:42Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
