You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.2 KiB
YAML
38 lines
1.2 KiB
YAML
---
|
|
- name: "Block to handle missing internal hetzner server network"
|
|
block:
|
|
- name: "Increment the retry count"
|
|
set_fact:
|
|
retry_count: "{{ retry_count | default(0) | int + 1 }}"
|
|
|
|
- name: "DEBUG"
|
|
debug:
|
|
msg: "current retry_count: {{ retry_count }}"
|
|
|
|
- name: "DEBUG"
|
|
debug:
|
|
msg: "ansible_all_ipv4_addresses: {{ ansible_all_ipv4_addresses }}"
|
|
|
|
- name: "DEBUG"
|
|
debug:
|
|
msg: "ansible_all_ipv4_addresses-FILTERED: {{ ansible_all_ipv4_addresses | ansible.netcommon.ipaddr(shared_service_network) }}"
|
|
|
|
- name: "DEBUG - break if only one IPv4-address was found"
|
|
assert:
|
|
that:
|
|
- ansible_all_ipv4_addresses | length == 2
|
|
rescue:
|
|
- name: "RESCUE - fail: Maximum retries reached"
|
|
fail:
|
|
msg: "max_retries of {{ max_retries }} reached. Plz check."
|
|
when: retry_count | int == max_retries | int
|
|
|
|
- name: "RESCUE: wait_for {{ retry_delay }} sec. between retries"
|
|
wait_for:
|
|
timeout: "{{ retry_delay }}"
|
|
delegate_to: localhost
|
|
become: false
|
|
|
|
- name: "Include _check_for_internal_address.yml one time again => increase retry_count"
|
|
include_tasks: _check_for_internal_address.yml
|