On 17.04.2018 20:47, ZillaYT wrote:
I tried the ideas from ansible-reboot-and-wait.yml exmaple
<https://gist.github.com/infernix/a968f23c4f4e1d6723e4>, and others with

That's over 4 years old, in this profession that is a lifetime.


similar approach, to no avail. So my tasks look like

# This command will reboot the node
- name: Upgrade Github host
  command: "ghe-upgrade {{ pkg_dir }}/{{ pkg_name }} --yes"

(It craps out after above task)

# Now we will run a local 'ansible -m ping' on this host until it returns. # This works with the existing ansible hosts inventory and so any custom
ansible_ssh_hosts definitions are being used
- local_action: shell ansible -u {{ ansible_ssh_user }} -m ping
github1.company.com
  register: result
  until: result.rc == 0
  retries: 30
  delay: 10


Any pointers on how I can make this work? Thanks!

If it's possible to make ghe-upgrade not reboot the server that would be easiest I guess. The reason is you don't not how long the upgrade process will take and make it hard to find a value for the delay bellow.

The reboot is as simple as

- name: reboot server
  shell: sleep 2 && reboot
  async: 1
  poll: 0

- name: Wait for server
  wait_for_connection:
    delay: 60

The delay must be at least as long it takes for the server to shutdown ssh, it not it will be able to connect again and the play continues.

--
Kai Stian Olstad

--
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/591a029cf4fb8c65c85437cb62443ced%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to