can ansible report if server needs restart (ubuntu && apt-get upgrade)

1,454 views
Skip to first unread message

Christian Schmitt

unread,
Aug 2, 2014, 6:40:27 PM8/2/14
to ansible...@googlegroups.com
Currently i'm running a playbook against multiple servers, is there a way to print something if a server needs a reboot after an apt-get upgrade?
i mean if the kernel gets upgraded i need to know which of them needs an restart.

is there a possible way that ansible could report such thing

Maciej Delmanowski

unread,
Aug 3, 2014, 11:55:53 AM8/3/14
to ansible...@googlegroups.com
Perhaps not the "Ansible way", but you could install 'update-notifer-common' package and see if /var/run/reboot-required file is present - perhaps via nagios or cron + mail message.



Maciej


--
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/620390e6-824b-4ac5-bbe3-783e5e7b20d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael DeHaan

unread,
Aug 3, 2014, 12:16:17 PM8/3/14
to ansible...@googlegroups.com
That seems pretty darn reasonable to me.

The ansible stat module could be used to check for presense of that file at the end of the run, and reboot (and wait for SSH to come back up) if so desired.




Schmitt, Christian

unread,
Aug 3, 2014, 12:55:13 PM8/3/14
to ansible...@googlegroups.com

And what about yum based systems? I already made a working playbook with the apt upgrade and its really awesome. Finally a solution to drop out puppet (:

Michael DeHaan

unread,
Aug 3, 2014, 2:30:25 PM8/3/14
to ansible...@googlegroups.com
It seems like it would be easy to execute something like


with the "script" module and key off the return code.




Reply all
Reply to author
Forward
0 new messages