updated uri, added rescue block
diff --git a/tasks/main.yml b/tasks/main.yml index 3c2e9ec..4cc9c8b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml
@@ -16,14 +16,28 @@ uuid: '{{ edge_mp_self.uUID }}' when: edge_mp_self is defined and server_type == 'mp' -- name: Set reachability to {{ reachable }} if set - uri: - user: '{{ opdk_user_email }}' - password: '{{ opdk_user_pass }}' - method: POST - body_format: json - force_basic_auth: yes - url: "http://{{ public_mgmt_ip }}:{{ ms_ext_mgmt_port }}/v1/servers/{{ uuid }}" - body: - reachable: '{{ reachable }}' - when: uuid is defined \ No newline at end of file +- block: + + - name: Set reachability to {{ reachable }} if set + uri: + user: '{{ opdk_user_email }}' + password: '{{ opdk_user_pass }}' + method: POST + body_format: json + force_basic_auth: yes + url: "http://{{ public_mgmt_ip }}:{{ ms_ext_mgmt_port }}/v1/servers/{{ uuid }}" + body: + reachable: '{{ reachable }}' + + rescue: + uri: + user: '{{ opdk_user_email }}' + password: '{{ opdk_user_pass }}' + method: POST + body_format: json + force_basic_auth: yes + url: "http://{{ local_mgmt_ip }}:{{ ms_ext_mgmt_port }}/v1/servers/{{ uuid }}" + body: + reachable: '{{ reachable }}' + + when: uuid is defined \ No newline at end of file