# Patching System with rollback function

**URL:** <https://forum.ansible.com/t/patching-system-with-rollback-function/37579>\
**Category:** Ansible Project\
**Created:** [January 25, 2023, 8:44am UTC](https://forum.ansible.com/t/patching-system-with-rollback-function/37579 "2023-01-25T08:44:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fabiuscom](https://avatars.discourse-cdn.com/v4/letter/f/dec6dc/32.png) [@Fabiuscom](https://forum.ansible.com/u/Fabiuscom)\
**Post date:** [January 25, 2023, 8:44am UTC](https://forum.ansible.com/t/patching-system-with-rollback-function/37579/1 "2023-01-25T08:44:29Z")

</div>

Hello, I need some information: if I want to install a patch using ansible, for example RHSA-2000:2023 and then I want to rollback because the patch has “brought” problems to the system, what could be a valid way to follow? Thank you

---

<div class="post-metadata">

**Author:** ![The\_Vandyy\_Vines](https://avatars.discourse-cdn.com/v4/letter/t/7993a0/32.png) [@The\_Vandyy\_Vines](https://forum.ansible.com/u/The_Vandyy_Vines)\
**Post date:** [January 25, 2023, 9:25am UTC](https://forum.ansible.com/t/patching-system-with-rollback-function/37579/2 "2023-01-25T09:25:59Z")

</div>

You may use block and rescue module in ansible to do that.  
[https://docs.ansible.com/ansible/latest/playbook\_guide/playbooks\_blocks.html#id2](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_blocks.html#id2)

---

<div class="post-metadata">

**Author:** ![fabiuscom1](https://avatars.discourse-cdn.com/v4/letter/f/77aa72/32.png) [@fabiuscom1](https://forum.ansible.com/u/fabiuscom1)\
**Post date:** [January 25, 2023, 10:22am UTC](https://forum.ansible.com/t/patching-system-with-rollback-function/37579/3 "2023-01-25T10:22:11Z")

</div>

ok, but this for immediately when i run the playbook, but if i want return back after some days?

---

<div class="post-metadata">

**Author:** ![Chris1](https://avatars.discourse-cdn.com/v4/letter/c/ac91a4/32.png) [@Chris1](https://forum.ansible.com/u/Chris1)\
**Post date:** [January 25, 2023, 11:10am UTC](https://forum.ansible.com/t/patching-system-with-rollback-function/37579/4 "2023-01-25T11:10:49Z")

</div>

I know the package module has different options then the ansible.builtin.yum module, but if you use the yum module - it has an ‘autoremove’ parameter.  
This auto remove parameter removes all ‘leaf’ packages from the system that were originally installed as dependencies for user-installed packages but which are no longer required by any such package.  
I haven’t tested this extensively, but it should be used with “state = absent”

I’m personally a paranoid person, so test / test / test 🙂

Chris
