It means that the task will run if it does find the string 'reboot' in the stdout of the registered reboot_hint variable. It's just calling this: https://docs.python.org/2/library/string.html#string.find
On Tue, Aug 4, 2015 at 6:44 AM Arbab Nazar <[email protected]> wrote: > 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 > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/cb5908ea-9587-4df4-b414-af3e9988a639%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/cb5908ea-9587-4df4-b414-af3e9988a639%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAPcsqxnTS1x-BXFdmyu8dhpjWOKut3Upkgb9vFfowEP6J3wL8w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
