Open rgl opened 6 months ago
@rgl - This is likely a docs issue, as setting the state
to downgrade
does, to my knowledge, what you're asking for here.
With that state set, if you don't specify a version it'll install the latest. If you do specify a version, then that version will be installed regardless of it it's a downgrade, upgrade, or fresh install.
I just encountered this issue but didn't have chance to test downgrade. It just seems counterintuitive to set everything to downgrade just to get a specific package version installed or upgraded.
I would think this functionality would rather suit well with the state:present where it should install, upgrade or downgrade to match the version you have assigned with present.
with this the state:downgrade would be redundant
Presently the behaviour of state: present
is that the task will fail if the package is installed at a different version, so changing that would be a breaking change.
state: downgrade
does do what's needed, and that somewhat inherits from choco's pattern where doing this would require a choco upgrade $version --allow-downgrade
-- it's weird to specify that for an upgrade action, but it's permitted even if the version specified is actually an upgrade.
We already have a couple aliased state names if memory serves, so adding a new alias for state: downgrade
would not be too hard to add really if it makes it more intuitive. I'm not really sold on any of the current suggestions for state names in this issue though so far.
Checklist
Is Your Feature Request Related To A Problem? Please describe.
I want to use Ansible to set the desirable state of specific package version. And have this module install, upgrade or downgrade iif the installed version is not the one I set. I do not want to use
force: true
because that would unnecessary reinstall the package every time.Describe The Solution. Why is it needed?
or, have extra flags like:
Additional Context
No response
Related Issues
No response