I’ve currently got a role that runs server updates. One of the facts it sets in there is “updates”. This can then be used as “updates.stdout_lines” to determine if there were any updates. There are 2 steps at the end of the role which reboot the server if there were updates and the ansible-shell step running “needs-restarting -r” registered a non zero return code (machine needs rebooting). At the moment I’ve had to set my device downtime at 30 minutes to allow time for updates to run and the reboot to take place. I’d like to split the reboot part into a seperate role so I can run the lm-device-sdt role immediately before the reboot and set it to 5 mins.
So I have 2 questions regarding this.
- How do I pass the fact from one role to another within the same playbook
- Is their a better way of doing this that doesn’t involve adding the lm-device-sdt into the existing role.