NETWAYS / ansible-collection-elasticstack

A collection to install and manage the Elastic Stack
GNU General Public License v3.0
9 stars 8 forks source link

Rethinking the changed_when: false #140

Closed afeefghannam89 closed 1 year ago

afeefghannam89 commented 1 year ago

I think, in some tasks checnged_when false does not serve any goal, we should check them again

widhalmt commented 1 year ago

Ok, if you find some, please try changing them. The less we have of these things, the better!

Donien commented 1 year ago

I've taken the time and created a branch deleting a few of the changed_when: false statements that seemed unnecessary to me.
In these cases checks are already performed to determine whether the task should even run. If it should, we have already determined that we expect a change, thus we can leave it out.

But from this arises a new problem: ansible-lint.
ansible-lint now complains about missing changed_when statements on the command and shell modules. We know it's (probably) correct but the linter does not.

I think we have two options here:

I'm not sure if the first option is desirable.
The second option does not get rid of the statements themselves. It, however, would better reflect actual changes made to the systems, which I believe to be a good thing.

TLDR

We could get rid of a few of those changed_when: false statements, but we'd need to change the linter rules.