Skip to content

Commit

Permalink
[FIX] Switch from wait_for to ping + delegate_to to force SSH usage (#35
Browse files Browse the repository at this point in the history
)

Co-authored-by: Giuseppe Di Piazza <[email protected]>
  • Loading branch information
patrikohlson and dipiazzg authored Feb 27, 2020
1 parent 364183d commit 66186dc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
1 change: 1 addition & 0 deletions clean/tasks/gce.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
service_account_file: "{{gcp_credentials_file}}"
register: gcp_dns_resource_record_set_info
with_items: "{{ cluster_hosts_flat }}"
when: (cluster_vars.dns_server is defined and cluster_vars.dns_server != "") and cluster_vars.dns_server=="clouddns" and (cluster_vars.dns_zone_external is defined and cluster_vars.dns_zone_external != "")

- name: Remove related clusterverse A records from clouddns only
gcp_dns_resource_record_set:
Expand Down
2 changes: 1 addition & 1 deletion config/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
with_items: "{{ cluster_hosts_flat }}"
when: cluster_vars.dns_server == "route53" and instance_to_create is undefined and rescuing_instance is undefined

- name: Create/Update DNS CNAME records in Cloud DNS via GCP
- name: Create/Update DNS CNAME records in Cloud DNS via GCP
gcp_dns_resource_record_set:
auth_kind: serviceaccount
managed_zone:
Expand Down
13 changes: 6 additions & 7 deletions dynamic_inventory/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@

- debug: msg="{{dynamic_inventory_flat}}"

- name: Wait for port 22 to become open and contain "OpenSSH".
wait_for:
port: 22
host: "{{ item.inventory_ip }}"
search_regex: OpenSSH
delay: 1
# The following is using ping (instead of wait_for to check for port 22) to actually establish SSH connectivity with the destination host,
# this is particularly useful if using a jumphost to access the destination host, and the ansible-running machine doesn't have direct access to it.
- name: Wait for SSH connectivity
ping:
delegate_to: "{{ item.inventory_ip }}"
with_items: "{{ dynamic_inventory_flat }}"
connection: local
retries: 12

- name: Add hosts to dynamic inventory
add_host:
Expand Down

0 comments on commit 66186dc

Please sign in to comment.