Hi Everyone, I have an ambiguity in the find command. Can somebody clarify it. I have paste the tasks down(copy from some blog post on the net). I have an ambiguity in the second task where it says
reboot_hint.stdout.find(“reboot”) != -1
What does it mean, that run this task if you will not find the “reboot” word in the value of reboot_init variable?
OR
run this task if you will find the “reboot” word in the value of reboot_init variable?
Thanks in advance
- name: Check for reboot hint.
shell: if [ $(readlink -f /vmlinuz) != /boot/vmlinuz-$(uname -r) ]; then echo 'reboot'; else echo 'no'; fi
ignore_errors: true
register: reboot_hint
- name: Rebooting ...
command: shutdown -r now "Ansible kernel update applied"
async: 0
poll: 0
ignore_errors: true
when: kernelup|changed or reboot_hint.stdout.find("reboot") != -1
register: rebooting
- name: Wait for thing to reboot...
pause: seconds=45
when: rebooting|changed