# Need Help for Install/Upgrade/Downgrade

**URL:** <https://forum.ansible.com/t/need-help-for-install-upgrade-downgrade/30834>\
**Category:** Ansible Project\
**Created:** [July 22, 2019, 11:04am UTC](https://forum.ansible.com/t/need-help-for-install-upgrade-downgrade/30834 "2019-07-22T11:04:18Z")\
**Posts on this page:** 5\
**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 22, 2019, 11:04am UTC](https://forum.ansible.com/t/need-help-for-install-upgrade-downgrade/30834/1 "2019-07-22T11:04:18Z")

</div>

I want to use simple single task for install/upgrade/downgrade . All 3 cases , I want to handle in one task:  
Currently I use 2 tasks:  
For Install:

- name: Install RPMs  
yum:  
name: ‘{{ rpm\_list }}’  
state: ‘latest’  
enablerepo: ‘{{ my\_repos\_names }}’  
disable\_gpg\_check: ‘{{ my\_allow\_unsigned\_rpms }}’  
update\_cache: ‘{{ my\_update\_cache }}’  
environment: “{{ proxy\_env }}”

For upgrade/downgrade I rely on calling below from shell module:

- name: “Performing Distribution Synchronization”  
shell: yum distro-sync -y --disablerepo=“{{repo\_to\_disable|default(‘\*’)}}” --enablerepo=“{{ Repo\_to\_enable}}”  
Since distro-sync option of yum works on already installed rpms.( Yum does not have anything for downgrading cases , already some issues on this on github)

How i can achieve all 3 operations from single task, any idea ?

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [July 22, 2019, 1:44pm UTC](https://forum.ansible.com/t/need-help-for-install-upgrade-downgrade/30834/2 "2019-07-22T13:44:22Z")

</div>

> I want to use simple single task for install/upgrade/downgrade . All 3 cases , I want to handle in one task:  
> Currently I use 2 tasks:  
> For Install:  
> - name: Install RPMs  
> yum:  
> name: '{{ rpm\_list }}'  
> state: 'latest'  
> enablerepo: '{{ my\_repos\_names }}'  
> disable\_gpg\_check: '{{ my\_allow\_unsigned\_rpms }}'  
> update\_cache: '{{ my\_update\_cache }}'  
> environment: "{{ proxy\_env }}"
> 
> For upgrade/downgrade I rely on calling below from shell module:
> 
> - name: "Performing Distribution Synchronization"  
> shell: yum distro-sync -y --disablerepo="{{repo\_to\_disable|default('\*')}}" --enablerepo="{{ Repo\_to\_enable}}"  
> Since distro-sync option of yum works on already installed rpms.( Yum does not have anything for downgrading cases ,  
> already some issues on this on github)
> 
> How i can achieve all 3 operations from single task, any idea ?

What are your objectives to do it in one task?

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<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 22, 2019, 1:54pm UTC](https://forum.ansible.com/t/need-help-for-install-upgrade-downgrade/30834/3 "2019-07-22T13:54:43Z")

</div>

I am trying to see if this 2 tasks can be optimized or written in single task . Nothing special , just for redundant purpose.

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [July 22, 2019, 1:59pm UTC](https://forum.ansible.com/t/need-help-for-install-upgrade-downgrade/30834/4 "2019-07-22T13:59:18Z")

</div>

> I am trying to see if this 2 tasks can be optimized or written in single task . Nothing special , just for redundant  
> purpose.

Unless you are going to write your own Ansible module, this doesn't make sense to me.

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<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 22, 2019, 2:01pm UTC](https://forum.ansible.com/t/need-help-for-install-upgrade-downgrade/30834/5 "2019-07-22T14:01:15Z")

</div>

Assume if this can be brought into. Ansible module . Then any way. If u know
