Joined April 2014
·
Posted to
Ansible: Reboot Ubuntu if needed
over 1 year
ago
I just use the "removes=" option for Ansible "command" module to selectively run the reboot - much simpler, and no handler needed.
tasks:
- name: Reboot system if required
command: shutdown -r now 'Rebooting to complete system upgrade'
removes=/var/run/reboot-required
Posted to
executable playbooks
over 1 year
ago
Actually, the non /usr/bin/env form doesn't work at all under MacOS X, because Darwin requires that the shebang interpreter be an executable binary program (not another shebang script) and all the Ansible commands are actually Python scripts. See http://stackoverflow.com/questions/9988125/shebang-pointing-to-script-also-having-shebang-is-effectively-ignored
Achievements
20 Karma
0 Total ProTip Views
Charity
Fork and commit to someone's open source project in need
Python
Would you expect anything less? Have at least one original repo where Python is the dominant language
This is a great idea, and you can even use the contextlib implementation in 3.2+ (or contextlib2 for Python 2.7): http://stackoverflow.com/a/9213668/18829