# yum downgrade \<RPM\> is not working in Ansible Command module

**URL:** <https://forum.ansible.com/t/yum-downgrade-rpm-is-not-working-in-ansible-command-module/30798>\
**Category:** Ansible Project\
**Created:** [July 17, 2019, 5:36am UTC](https://forum.ansible.com/t/yum-downgrade-rpm-is-not-working-in-ansible-command-module/30798 "2019-07-17T05:36:16Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rahul\_Kumar1](https://avatars.discourse-cdn.com/v4/letter/r/da6949/32.png) [@Rahul\_Kumar1](https://forum.ansible.com/u/Rahul_Kumar1)\
**Post date:** [July 17, 2019, 5:36am UTC](https://forum.ansible.com/t/yum-downgrade-rpm-is-not-working-in-ansible-command-module/30798/1 "2019-07-17T05:36:16Z")

</div>

I am using Ansible command module to downgrade the package (assuming higher version is already installed and  
repo has both lower and higher version). I dont want to use Anisble yum module due to some constraints.  
I am not able to invoke yum downgrade from command module.

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [July 17, 2019, 5:57am UTC](https://forum.ansible.com/t/yum-downgrade-rpm-is-not-working-in-ansible-command-module/30798/2 "2019-07-17T05:57:18Z")

</div>

> I am using Ansible command module to downgrade the package (assuming higher version is already installed and  
> repo has both lower and higher version). I dont want to use Anisble yum module due to some constraints.  
> I am not able to invoke yum downgrade from command module.

What does this mean?  
Did you get an error message?  
Or did the task run OK but the package wasn’t downgraded?  
Without knowing what you did it’s impossible to help. So please show the task.

You should be able to invoke any command using the command module.

Dick

---

<div class="post-metadata">

**Author:** ![Rahul\_Kumar1](https://avatars.discourse-cdn.com/v4/letter/r/da6949/32.png) [@Rahul\_Kumar1](https://forum.ansible.com/u/Rahul_Kumar1)\
**Post date:** [July 17, 2019, 6:04am UTC](https://forum.ansible.com/t/yum-downgrade-rpm-is-not-working-in-ansible-command-module/30798/3 "2019-07-17T06:04:21Z")

</div>

This is the playbook.

---

<div class="post-metadata">

**Author:** ![Michael\_M1](https://avatars.discourse-cdn.com/v4/letter/m/e274bd/32.png) [@Michael\_M1](https://forum.ansible.com/u/Michael_M1)\
**Post date:** [July 17, 2019, 6:13am UTC](https://forum.ansible.com/t/yum-downgrade-rpm-is-not-working-in-ansible-command-module/30798/4 "2019-07-17T06:13:33Z")

</div>

I think you just need the '-y' switch.

yum -y downgrade \<rpm\_name\>

---

<div class="post-metadata">

**Author:** ![Rahul\_Kumar1](https://avatars.discourse-cdn.com/v4/letter/r/da6949/32.png) [@Rahul\_Kumar1](https://forum.ansible.com/u/Rahul_Kumar1)\
**Post date:** [July 17, 2019, 6:17am UTC](https://forum.ansible.com/t/yum-downgrade-rpm-is-not-working-in-ansible-command-module/30798/5 "2019-07-17T06:17:49Z")

</div>

No -y option also does not work. Well yum downgrade is a valid command and working outside Ansible.

---

<div class="post-metadata">

**Author:** ![Pshem\_Kowalczyk](https://avatars.discourse-cdn.com/v4/letter/p/e480ec/32.png) [@Pshem\_Kowalczyk](https://forum.ansible.com/u/Pshem_Kowalczyk)\
**Post date:** [July 17, 2019, 6:23am UTC](https://forum.ansible.com/t/yum-downgrade-rpm-is-not-working-in-ansible-command-module/30798/6 "2019-07-17T06:23:42Z")

</div>

Run playbook with ‘-vv’ appended and show us the output.

kind regards  
Pshem

---

<div class="post-metadata">

**Author:** ![Rahul\_Kumar1](https://avatars.discourse-cdn.com/v4/letter/r/da6949/32.png) [@Rahul\_Kumar1](https://forum.ansible.com/u/Rahul_Kumar1)\
**Post date:** [July 17, 2019, 6:32am UTC](https://forum.ansible.com/t/yum-downgrade-rpm-is-not-working-in-ansible-command-module/30798/7 "2019-07-17T06:32:47Z")

</div>

Well , I tried again and found some abnormal behaviour.  
Observed once i use -y option as below:

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [July 17, 2019, 6:36am UTC](https://forum.ansible.com/t/yum-downgrade-rpm-is-not-working-in-ansible-command-module/30798/8 "2019-07-17T06:36:33Z")

</div>

Could it be that this is some custom package and that it’s installation somehow depends on environment variables being present?

What is the rpmname?

Dick

---

<div class="post-metadata">

**Author:** ![Rahul\_Kumar1](https://avatars.discourse-cdn.com/v4/letter/r/da6949/32.png) [@Rahul\_Kumar1](https://forum.ansible.com/u/Rahul_Kumar1)\
**Post date:** [July 17, 2019, 6:45am UTC](https://forum.ansible.com/t/yum-downgrade-rpm-is-not-working-in-ansible-command-module/30798/9 "2019-07-17T06:45:11Z")

</div>

Yes , its custom enterprise specific rpm . But if i do manually (outside ansible), these commands work perfectly . Morover it dont have any dependency on other rpm and even on env.

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [July 17, 2019, 6:48am UTC](https://forum.ansible.com/t/yum-downgrade-rpm-is-not-working-in-ansible-command-module/30798/10 "2019-07-17T06:48:42Z")

</div>

Exactly, by doing it manually your environment has different variables set.

What happens if you use the shell module instead of command?

---

<div class="post-metadata">

**Author:** ![Rahul\_Kumar1](https://avatars.discourse-cdn.com/v4/letter/r/da6949/32.png) [@Rahul\_Kumar1](https://forum.ansible.com/u/Rahul_Kumar1)\
**Post date:** [July 17, 2019, 6:54am UTC](https://forum.ansible.com/t/yum-downgrade-rpm-is-not-working-in-ansible-command-module/30798/11 "2019-07-17T06:54:10Z")

</div>

Well , it is same behavior as of command module . i.e if I use -y option , both rpms will be there in system and task is stuck and i have to manually terminate.  
How is it possible, 2 version of same rpms on machine and even task is stuck.

---

<div class="post-metadata">

**Author:** ![P.Cookson](https://avatars.discourse-cdn.com/v4/letter/p/a6a055/32.png) [@P.Cookson](https://forum.ansible.com/u/P.Cookson)\
**Post date:** [July 17, 2019, 7:43am UTC](https://forum.ansible.com/t/yum-downgrade-rpm-is-not-working-in-ansible-command-module/30798/12 "2019-07-17T07:43:38Z")

</div>

Can you clarify what constraint the “yum” module has as I would be surprised if it can’t accommodate all common yum related tasks? Can’t you just specify package name with version (name) and enable downgrade (allow\_downgrade)?

[https://docs.ansible.com/ansible/latest/modules/yum\_module.html#yum-module](https://docs.ansible.com/ansible/latest/modules/yum_module.html#yum-module)

Regards

Phil

---

<div class="post-metadata">

**Author:** ![Rahul\_Kumar1](https://avatars.discourse-cdn.com/v4/letter/r/da6949/32.png) [@Rahul\_Kumar1](https://forum.ansible.com/u/Rahul_Kumar1)\
**Post date:** [July 17, 2019, 7:45am UTC](https://forum.ansible.com/t/yum-downgrade-rpm-is-not-working-in-ansible-command-module/30798/13 "2019-07-17T07:45:48Z")

</div>

Hi Phil,  
I have already filed a issue as requested by Ansible Team, All Details can be found here:

[https://github.com/ansible/ansible/issues/59146](https://github.com/ansible/ansible/issues/59146)’

Regards

Rahul

---

<div class="post-metadata">

**Author:** ![P.Cookson](https://avatars.discourse-cdn.com/v4/letter/p/a6a055/32.png) [@P.Cookson](https://forum.ansible.com/u/P.Cookson)\
**Post date:** [July 17, 2019, 8:33am UTC](https://forum.ansible.com/t/yum-downgrade-rpm-is-not-working-in-ansible-command-module/30798/14 "2019-07-17T08:33:41Z")

</div>

See what you mean now. Seems that others have raised a similar issue, previously, but not sure there has ever been a resolution? Possibly worth searching for something useful in Galaxy perhaps (see eg below, if not used before)?

# ansible-galaxy search plugins

# ansible-galaxy info

Regards

Phil

---

<div class="post-metadata">

**Author:** ![Rahul\_Kumar1](https://avatars.discourse-cdn.com/v4/letter/r/da6949/32.png) [@Rahul\_Kumar1](https://forum.ansible.com/u/Rahul_Kumar1)\
**Post date:** [July 17, 2019, 9:30am UTC](https://forum.ansible.com/t/yum-downgrade-rpm-is-not-working-in-ansible-command-module/30798/15 "2019-07-17T09:30:20Z")

</div>

Thanks … I am not sure , if enable\_plugin option under YUM ansible module is related to such plugins , as description in documentation is not sufficient for end user to understand.  
I am looking for smallest play which make use of enable\_plugin option while using yum module for better understanding of same.

Regards  
Rahul
