Check for reboot

Hello,

We are currently using Ansible to install security updates to our Ubuntu 14.04 servers. We are using apticron to tell us when updates are available and we are using unattended-upgrades to install the updates. We want to manually reboot the server not when it installs the updates.

We would like to run an ansible playbook to output what servers are in need of a reboot. I now you can check to see if /var/run/reboot-required is listed, but i’m not sure how to output it.

Any help would be appreciated.

Thanks

Have you checked the examples in the documentation for the stat module
https://docs.ansible.com/ansible/stat_module.html#examples

Maybe that solves your need.

Thanks. I found this link that is similar:

https://realguess.net/2014/12/21/ansible-update-servers-to-the-latest-and-reboot/

But that only reboots it if exists, i just need it to say yes or no that it exists.

Hello Marvin. Maybe you can make use of debug module: http://docs.ansible.com/ansible/debug_module.html. You could print out a message for the user to know when conditions are met for reboot.

Best regards.