DEV-452: added workaround to fix problem with missing hetzner internal network

feature/DEV-380
friedrich goerz 4 years ago
parent 31e79f7ee6
commit f7a43f5981

@ -0,0 +1,37 @@
---
- 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

@ -9,6 +9,11 @@
name: hcloud
tasks_from: _set_server_state
- name: "Checking if internal network up and runnig for <{{ inventory_hostname }}>"
include_role:
name: hcloud
tasks_from: _check_for_internal_address
- name: "Gathering current server infos from hetzner"
hcloud_server_info:
api_token: "{{ hetzner_authentication_ansible }}"

@ -19,23 +19,6 @@
user={{ mysql_root_username }}
password={{ mysql_root_password }}
- 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
debug:
msg: "ansible_all_ipv4_addresses-FILTERED-firstelem: {{ ansible_all_ipv4_addresses | ansible.netcommon.ipaddr(shared_service_network) | first }}"
- name: DEBUG - break if only one IPv4-address was found
assert:
that:
- ansible_all_ipv4_addresses | length == 2
- name: "Install mariadb via include_role"
vars:
mysql_packages:

Loading…
Cancel
Save