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

133 views
Skip to first unread message

Rahul Kumar

unread,
Jul 17, 2019, 1:36:16 AM7/17/19
to Ansible Project
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 <rpmname> from command module.

Dick Visser

unread,
Jul 17, 2019, 1:57:38 AM7/17/19
to ansible...@googlegroups.com
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


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/446ee6a4-519d-4711-87e1-be3ea35a09e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Sent from a mobile device - please excuse the brevity, spelling and punctuation.

Rahul Kumar

unread,
Jul 17, 2019, 2:04:21 AM7/17/19
to Ansible Project
This is the playbook.
---
- hosts: localhost
  tasks:
     - name: Install specific version of a package in Ansible.
       command: yum downgrade <rpm_name>

Task is stuck at this point of time, however all other yum commands such as (yum info <rpmname> etc. ) are working fine in command module.
But if i try same command 'yum downgrade <rpm_name>' manually , it works.

On Wednesday, 17 July 2019 11:27:38 UTC+5:30, Dick Visser wrote:
On Wed, 17 Jul 2019 at 07:36, Rahul Kumar <rajput...@gmail.com> wrote:
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 <rpmname> 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


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible...@googlegroups.com.

Michael Mullay

unread,
Jul 17, 2019, 2:14:24 AM7/17/19
to ansible...@googlegroups.com
I think you just need the '-y' switch.

yum -y downgrade <rpm_name>
> To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/172d66ef-3633-4117-af54-4443a9c0c899%40googlegroups.com.

Rahul Kumar

unread,
Jul 17, 2019, 2:18:12 AM7/17/19
to ansible...@googlegroups.com
No -y option also does not work.   Well yum downgrade <rpm> is a valid command and working outside Ansible. 

Pshem Kowalczyk

unread,
Jul 17, 2019, 2:24:04 AM7/17/19
to Ansible Project
Run playbook with '-vv' appended and show us the output.

kind regards
Pshem


Rahul Kumar

unread,
Jul 17, 2019, 2:33:06 AM7/17/19
to ansible...@googlegroups.com
Well , I tried again  and found some abnormal behaviour.
Observed once i use -y option as below:
---
- hosts: localhost
  tasks:
     - name: Install specific version of a package in Ansible.
       command: yum -y downgrade <rpmname>
~

TASK is stuck and no logs as below:
TASK [Install specific version of a package in Ansible.] ************************************************************************************************************************************
task path: /var/opt/OC/iso/downgrade_playbook.yml:4

And i abormally terminates this after some time. But surprisingly i found both version of rpm install once i do :
rpm -qa | grep <rpm name>
rpmname.v1
rpmname.v2

Its strange and its not the behaviour of yum downgrade as compared to once someone run manually this command.

Dick Visser

unread,
Jul 17, 2019, 2:36:54 AM7/17/19
to ansible...@googlegroups.com
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




For more options, visit https://groups.google.com/d/optout.

Rahul Kumar

unread,
Jul 17, 2019, 2:45:31 AM7/17/19
to ansible...@googlegroups.com
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. 

Dick Visser

unread,
Jul 17, 2019, 2:49:01 AM7/17/19
to ansible...@googlegroups.com
Exactly, by doing it manually your environment has different variables set. 
What happens if you use the shell module instead of command?


For more options, visit https://groups.google.com/d/optout.

Rahul Kumar

unread,
Jul 17, 2019, 2:54:32 AM7/17/19
to ansible...@googlegroups.com
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.

P.Co...@bham.ac.uk

unread,
Jul 17, 2019, 3:43:48 AM7/17/19
to ansible...@googlegroups.com

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

 

Regards

Phil

Rahul Kumar

unread,
Jul 17, 2019, 3:46:09 AM7/17/19
to ansible...@googlegroups.com
Hi Phil,
I have already filed a issue as requested by Ansible Team, All Details can be found here:

P.Co...@bham.ac.uk

unread,
Jul 17, 2019, 4:33:52 AM7/17/19
to ansible...@googlegroups.com

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 <Author Name>

Rahul Kumar

unread,
Jul 17, 2019, 5:30:41 AM7/17/19
to ansible...@googlegroups.com
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

Reply all
Reply to author
Forward
0 new messages