From cd09b5bb5e049e28628b89262aa9e572f195521d Mon Sep 17 00:00:00 2001 From: friedrich goerz Date: Tue, 3 May 2022 11:16:27 +0200 Subject: [PATCH] DEV-452: added workaround to fix problem with missing hetzner internal network --- .../tasks/_check_for_internal_address.yml | 23 ++++--------------- roles/hcloud/tasks/main.yml | 4 ++++ 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/roles/hcloud/tasks/_check_for_internal_address.yml b/roles/hcloud/tasks/_check_for_internal_address.yml index cc60546..a725c0f 100644 --- a/roles/hcloud/tasks/_check_for_internal_address.yml +++ b/roles/hcloud/tasks/_check_for_internal_address.yml @@ -1,13 +1,8 @@ --- +# bunch of task statements needed to check if internal network is accessible or not +# if not, call _set_server_state.yml - 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: @@ -22,16 +17,6 @@ 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 + - name: "Include _set_server_state.yml to hopefully fix error with throwing server object against hetzner API" + include_tasks: _set_server_state.yml diff --git a/roles/hcloud/tasks/main.yml b/roles/hcloud/tasks/main.yml index 01a3262..e26279e 100644 --- a/roles/hcloud/tasks/main.yml +++ b/roles/hcloud/tasks/main.yml @@ -9,6 +9,10 @@ name: hcloud tasks_from: _set_server_state +# step needed to catch hetzner errors on servers where internal network not ready +# => will result in fails of ansible run due to expecting two IPv4 addresses in +# ansible_all_ipv4_addresses but only one was found +# => DEV-452 - name: "Checking if internal network up and runnig for <{{ inventory_hostname }}>" include_role: name: hcloud