Skip to content

Commit

Permalink
Add wait for ssh:22 in all machines to run terraform and ansible sequ…
Browse files Browse the repository at this point in the history
…entially
  • Loading branch information
iknite committed Mar 1, 2019
1 parent 881bf51 commit 833d915
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions deploy/aws/provision/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,25 @@

- hosts: all
remote_user: ec2-user
become: true
gather_facts: false
tasks:
- name: Wait 300 seconds for port 22 to become open and contain "OpenSSH"
- set_fact:
host_to_wait_for: "{{ ansible_ssh_host | default(inventory_hostname) }}"
- name: waiting for server to be alive
wait_for:
state: started
port: 22
host: "{{ host_to_wait_for }}"
delay: 10
timeout: 300
connect_timeout: 300
search_regex: OpenSSH
delegate_to: localhost

- hosts: all
remote_user: ec2-user
become: true
tasks:
- name: Gather facts
setup:

Expand Down

0 comments on commit 833d915

Please sign in to comment.