what I'm using as part of a (multi-hosts) play:
Task one is to async trigger the reboot
Task two the wait for ssh to come back (for each host in the play)
- name: Reboot the system
shell: sleep 2 && shutdown -r now "Ansible reboot triggered"
become: True
async: 1
poll: 0
ignore_errors: true
# FixMe: Trigger the wait for ssh on all the targets (long operation)
- name: waiting for server to come back
wait_for:
host: "{{ inventory_hostname }}"
port: 22
delay: 15
timeout: 1200
connect_timeout: 15
state: started
delegate_to: localhost
2017-10-03 18:31 GMT+02:00 leam hall <[email protected]>:
>
> On Tuesday, October 3, 2017 at 11:37:06 AM UTC-4, leam hall wrote:
>>
>> On Tuesday, October 3, 2017 at 11:31:57 AM UTC-4, Kai Stian Olstad wrote:
>>>
>>> On 03. okt. 2017 17:14, leam hall wrote:
>>> > Which should call playbooks/roles/reboot/tasks/main.yml:
>>> > https://github.com/LeamHall/Ansible_Test/blob/master/playboo
>>> ks/roles/reboot/tasks/main.yml
>>> >
>>> > - name: reboot_and_wait_for
>>> > include: reboot_node.yml
>>> > include: wait_for.yml
>>> > include: debug.yml
>>> >
>>> > with_items:
>>> > - "{{ hosts }}"
>>> You can't have 3 includes in 1 task, you will need to split them into 3
>>> separate tasks.
>>>
>>>
>> Kai, thanks! The issue is that I'm really struggling to get the
>> "wait_for" to work. I need to have the rebooted machine up before I boot
>> the next one. Any good pointers to docs? Ansible docs say it can be done
>> but don't seem to show you how.
>>
>> Leam
>>
>
>
> This is about the best I have so far. When I tried to put the duplicate
> tasks into a role it didn't work. May try an "include_tasks" after a nap.
>
> https://github.com/LeamHall/Ansible_Test/blob/master/
> playbooks/reboot_nodes.yml
>
>
>
> --
> 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/75ef60bc-c45d-49d0-ac97-03c0ee26e86c%40googlegroups.
> com
> <https://groups.google.com/d/msgid/ansible-project/75ef60bc-c45d-49d0-ac97-03c0ee26e86c%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/CAB1FMuT-OOaj%2B%3DvZBH5KrNqUzOCQE7j%2B0iaBdq34Ly02bG12Mw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.