On Sun, 18 Aug 2019 03:45:20 -0500 Mike Eggleston <[email protected]> wrote: > I am working on a playbook that uses yum. When yum does an update of all > installed packages I want to do a conditional shutdown -r. What condition > do I check from the yum task succeeding? > Mike
1) If you want to reboot on any change just notify a handler
- yum:
...
notify: reboot
Note: "update_cache" makes "yum" report "changed" even when no package have
been changed (installed/upgraded/downgraded); hence "update_cache" in a
separate task.
2) If you want to reboot on a particular combination of changes register
"yum_result" and make your choice.
- yum:
...
register: yum_result
- command: shutdown -r
when: <condition based on yum_result>
Note: See details in
How to access information in ansible yum list result?
https://stackoverflow.com/questions/49272469/how-to-access-information-in-ansible-yum-list-result
Cheers,
-vlado
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/20190818114717.7426cc2e%40gmail.com.
pgpeR3e82qj2A.pgp
Description: OpenPGP digital signature
