Increase timeout of SSH command in Ansible

You're going to want to run the task asynchronously. High-level steps would be:

  1. send deployment request for instance
  2. get some kind of instance or request id for said request
  3. poll for result of request
  4. continue playbook

here's an example of this behaviour from the official docs

- name: 'YUM - fire and forget task'
  yum:
    name: docker-io
    state: installed
  async: 1000
  poll: 0
  register: yum_sleeper

- name: 'YUM - check on fire and forget task'
  async_status:
    jid: "{{ yum_sleeper.ansible_job_id }}"
  register: job_result
  until: job_result.finished
  retries: 30
  delay: 10

Tags:

Ssh

Ansible