Exactly, by doing it manually your environment has different variables set.
What happens if you use the shell module instead of command?

On Wed, 17 Jul 2019 at 08:45, Rahul Kumar <[email protected]> wrote:

> 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.
>
> On Wed, 17 Jul 2019 at 12:06, Dick Visser <[email protected]> wrote:
>
>> 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
>>
>>
>>
>> On Wed, 17 Jul 2019 at 08:33, Rahul Kumar <[email protected]> wrote:
>>
>>> 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.
>>>
>>> On Wed, 17 Jul 2019 at 11:54, Pshem Kowalczyk <[email protected]> wrote:
>>>
>>>> Run playbook with '-vv' appended and show us the output.
>>>>
>>>> kind regards
>>>> Pshem
>>>>
>>>>
>>>> On Wed, 17 Jul 2019 at 18:18, Rahul Kumar <[email protected]>
>>>> wrote:
>>>>
>>>>> No -y option also does not work.   Well yum downgrade <rpm> is a valid
>>>>> command and working outside Ansible.
>>>>>
>>>>> On Wed, 17 Jul 2019 at 11:44, Michael Mullay <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> I think you just need the '-y' switch.
>>>>>>
>>>>>> yum -y downgrade <rpm_name>
>>>>>>
>>>>>> On Tue, Jul 16, 2019 at 11:04 PM Rahul Kumar <[email protected]>
>>>>>> wrote:
>>>>>> >
>>>>>> > 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 <[email protected]>
>>>>>> 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 [email protected].
>>>>>> >>> To post to this group, send email to [email protected].
>>>>>> >>> 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.
>>>>>> >
>>>>>> > --
>>>>>> > 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 [email protected].
>>>>>> > To post to this group, send email to
>>>>>> [email protected].
>>>>>> > To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/ansible-project/172d66ef-3633-4117-af54-4443a9c0c899%40googlegroups.com
>>>>>> .
>>>>>> > For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>> --
>>>>>> 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 [email protected].
>>>>>> To post to this group, send email to [email protected]
>>>>>> .
>>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/ansible-project/CAH4rTPtKNJbhcODCfn_EezwNFqSviH2_NN%3DO1xTpjuseW%2B%2BZBw%40mail.gmail.com
>>>>>> .
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>> --
>>>>> 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 [email protected].
>>>>> To post to this group, send email to [email protected].
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/ansible-project/CAGH8rEywUuKmUJydXqg5T2yr%3DVEH2RHcBt%3D9P_zRn8cvwKMzbg%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/ansible-project/CAGH8rEywUuKmUJydXqg5T2yr%3DVEH2RHcBt%3D9P_zRn8cvwKMzbg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>> --
>>>> 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 [email protected].
>>>> To post to this group, send email to [email protected].
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/ansible-project/CAEaZiRUiZrjHdgF8C0b%2B0r7KqR4jFALh8%2BCuQ0GibvpO2wswwQ%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/ansible-project/CAEaZiRUiZrjHdgF8C0b%2B0r7KqR4jFALh8%2BCuQ0GibvpO2wswwQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> --
>>> 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 [email protected].
>>> To post to this group, send email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/CAGH8rExNqRDKTJnKGN8Gvv%3DsLbTO5Dx6MVDg5o4FVbFNkt7OkQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/ansible-project/CAGH8rExNqRDKTJnKGN8Gvv%3DsLbTO5Dx6MVDg5o4FVbFNkt7OkQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> Sent from a mobile device - please excuse the brevity, spelling and
>> punctuation.
>>
>> --
>> 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 [email protected].
>> To post to this group, send email to [email protected].
>>
> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAL8fbwP2aDw-kUdHuGMmQfozUv%3DVWOGP_NOXYMzeRNn%3D2tF8ew%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CAL8fbwP2aDw-kUdHuGMmQfozUv%3DVWOGP_NOXYMzeRNn%3D2tF8ew%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAGH8rExm0Baatynzr%3DvaKfG4ErWt-MdQyqwRxXKNFL1pi%2B10rw%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAGH8rExm0Baatynzr%3DvaKfG4ErWt-MdQyqwRxXKNFL1pi%2B10rw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 
Sent from a mobile device - please excuse the brevity, spelling and
punctuation.

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwMQ4F6QoFm%2BWRBTYoQkYXvxf6rhvbA06Obq0myGTT-JBg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to