# \[Vote ended on 2024-07-02\] Avoid using aliases for module options

**URL:** <https://forum.ansible.com/t/vote-ended-on-2024-07-02-avoid-using-aliases-for-module-options/6069>\
**Category:** Project Discussions\
**Tags:** resolved, documentation, collections, ansible-core\
**Created:** [May 29, 2024, 7:02pm UTC](https://forum.ansible.com/t/vote-ended-on-2024-07-02-avoid-using-aliases-for-module-options/6069 "2024-05-29T19:02:14Z")\
**Posts on this page:** 10\
**Page:** 1

<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:** [May 29, 2024, 7:02pm UTC](https://forum.ansible.com/t/vote-ended-on-2024-07-02-avoid-using-aliases-for-module-options/6069/1 "2024-05-29T19:02:14Z")

</div>

I think we should discuss [avoid using aliases](https://github.com/ansible/ansible-documentation/pull/1539). What do you think? At first glance, it makes sense 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:** [May 29, 2024, 7:07pm UTC](https://forum.ansible.com/t/vote-ended-on-2024-07-02-avoid-using-aliases-for-module-options/6069/2 "2024-05-29T19:07:09Z")

</div>

I agree with this recommendation (and gave similar suggestions in quite a few reviews, and try to avoid them myself as well).

I think the main reason against aliases is that they can quickly lead to confusion: say you’re using both an option and an alias and don’t spot it immediately; or you and a colleague talk about a feature and you’re disagreeing of how it’s called, only to realize that one of you is using an alias.

There are also valid uses for aliases, so it’s definitely not a good idea to completely forbid them. But recommending to avoid them is still a good thing, to make folks at least think twice before adding a new one!

---

<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:** [May 29, 2024, 7:30pm UTC](https://forum.ansible.com/t/vote-ended-on-2024-07-02-avoid-using-aliases-for-module-options/6069/3 "2024-05-29T19:30:11Z")

</div>

> [@felixfontein](#):
>
> There are also valid uses for aliases, so it’s definitely not a good idea to completely forbid them.

The PR doesn’t forbid aliases completely, it says:

> Generally avoid using aliases.

_Generally_ is important here 😉

And it also says:

> Consider using them temporarily in exceptional cases like typos or inappropriate words in the original argument name with deprecation and subsequent removal of the original one using the `deprecated_aliases` attribute.

So it still allows using aliases. The PR allows to use aliases if there’s a valid use case.

---

<div class="post-metadata">

**Author:** ![sshnaidm](https://avatars.discourse-cdn.com/v4/letter/s/b38774/32.png) [@sshnaidm](https://forum.ansible.com/u/sshnaidm)\
**Post date:** [May 30, 2024, 4:31am UTC](https://forum.ansible.com/t/vote-ended-on-2024-07-02-avoid-using-aliases-for-module-options/6069/4 "2024-05-30T04:31:25Z")

</div>

Aliases are not added because of “bad naming”, it helps to manage compatibility during various changes. For example in Podman we have arguments that fit Podman args, which are VERY changing in time, but also tries to have compatibility with Docker args. And every other software changes its arguments with aliases, that’s a real life.  
Misuse and abuse can destroy any good idea, it doesn’t mean the idea was wrong. I’m totally for `deprecated_aliases` shortcut though, which will save time of working on deprecation messages.

---

<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:** [May 30, 2024, 5:01am UTC](https://forum.ansible.com/t/vote-ended-on-2024-07-02-avoid-using-aliases-for-module-options/6069/5 "2024-05-30T05:01:46Z")

</div>

I think the idea of providing guidance around best practices for aliases is good, but I do not find the way it’s currently phrased helpful. I would go for something more like this:

> Excessive use of aliases can make module interfaces confusing, so we recommend adding them only when necessary. If you are updating argument names to fix a typo or improve the interface, consider moving the old names to `deprecated_aliases` rather than keeping them around indefinitely.

---

<div class="post-metadata">

**Author:** ![Andersson007](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/andersson007/32/89_2.png) [@Andersson007](https://forum.ansible.com/u/Andersson007)\
**Post date:** [May 30, 2024, 7:49am UTC](https://forum.ansible.com/t/vote-ended-on-2024-07-02-avoid-using-aliases-for-module-options/6069/6 "2024-05-30T07:49:44Z")

</div>

> [@flowerysong](#):
>
> Excessive use of aliases can make module interfaces confusing, so we recommend adding them only when necessary. If you are updating argument names to fix a typo or improve the interface, consider moving the old names to `deprecated_aliases` rather than keeping them around indefinitely.

@flowerysong your wording SGTM, would you like to suggest the change in the PR so that you’ll be a co-author? If you miss this message anyhow, I’ll update it myself in a day or two. Thanks!

---

<div class="post-metadata">

**Author:** ![Andersson007](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/andersson007/32/89_2.png) [@Andersson007](https://forum.ansible.com/u/Andersson007)\
**Post date:** [June 25, 2024, 9:17am UTC](https://forum.ansible.com/t/vote-ended-on-2024-07-02-avoid-using-aliases-for-module-options/6069/7 "2024-06-25T09:17:54Z")

</div>

[@SteeringCommittee](https://forum.ansible.com/groups/steeringcommittee) and community please vote. The poll will end on 2024-07-02.

_Poll ([view on site](https://forum.ansible.com/t/vote-ended-on-2024-07-02-avoid-using-aliases-for-module-options/6069/7))_

_Poll ([view on site](https://forum.ansible.com/t/vote-ended-on-2024-07-02-avoid-using-aliases-for-module-options/6069/7))_

---

<div class="post-metadata">

**Author:** ![gundalow](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/gundalow/32/99_2.png) [@gundalow](https://forum.ansible.com/u/gundalow)\
**Post date:** [June 29, 2024, 2:29pm UTC](https://forum.ansible.com/t/vote-ended-on-2024-07-02-avoid-using-aliases-for-module-options/6069/8 "2024-06-29T14:29:09Z")

</div>

> [@sshnaidm](#):
>
> Aliases are not added because of “bad naming”, it helps to manage compatibility during various changes. For example in Podman we have arguments that fit Podman args, which are VERY changing in time, but also tries to have compatibility with Docker args. And every other software changes its arguments with aliases, that’s a real life.

This seems like a perfectly valid use of Aliases, thanks for sharing this example.

---

<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:** [June 29, 2024, 3:01pm UTC](https://forum.ansible.com/t/vote-ended-on-2024-07-02-avoid-using-aliases-for-module-options/6069/9 "2024-06-29T15:01:34Z")

</div>

> [@sshnaidm](#):
>
> Aliases are not added because of “bad naming”

Sometimes they are. Let’s say they are not _only / always_ added because of bad naming 😏

I agree with @gundalow that your example is a valid use-case for aliases. But the text in the PR wouldn’t forbid this, would it? It says

> adding them only when necessary

and in your example I think there’s a strong argument that it is.

---

<div class="post-metadata">

**Author:** ![Andersson007](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/andersson007/32/89_2.png) [@Andersson007](https://forum.ansible.com/u/Andersson007)\
**Post date:** [July 2, 2024, 10:29am UTC](https://forum.ansible.com/t/vote-ended-on-2024-07-02-avoid-using-aliases-for-module-options/6069/10 "2024-07-02T10:29:18Z")

</div>

Closed the polls and merged the PR, thanks everyone!
