blob: 8c1e42916e9a8b2f843203159ba2319bd080113e [file] [log] [blame]
---
# tasks file for apigee-opdk-set-reachable
#- name: Check for running server
- block:
- name: Check for {{ server_type }} self report
opdk_server_self:
server_type: '{{ server_type }}'
username: '{{ opdk_user_email }}'
password: '{{ opdk_user_pass }}'
- name: Set success
set_fact:
self_status: true
rescue:
- name: Set success
set_fact:
self_status: false
- name: Persist server_type setting
cache:
key: 'server_type'
value: '{{ server_type }}'
- name: Persist reachability setting
cache:
key: 'reachability'
value: '{{ reachability }}'
- block:
- name: Set uuid if router
set_fact:
uuid: '{{ edge_router_self.uUID }}'
when: edge_router_self is defined and server_type == 'router'
- name: Set uuid if message processor
set_fact:
uuid: '{{ edge_mp_self.uUID }}'
when: edge_mp_self is defined and server_type == 'mp'
- block:
- name: Use public {{ public_mgmt_ip }} to set reachability to {{ reachable }} if set
uri:
user: '{{ opdk_user_email }}'
password: '{{ opdk_user_pass }}'
method: POST
body_format: raw
url: "http://{{ public_mgmt_ip }}:{{ ms_ext_mgmt_port }}/v1/servers/{{ uuid }}"
body: reachable={{ reachable }}
rescue:
- name: Use local {{ local_mgmt_ip }} to set reachability to {{ reachable }} if set
uri:
user: '{{ opdk_user_email }}'
password: '{{ opdk_user_pass }}'
method: POST
body_format: raw
url: "http://{{ local_mgmt_ip }}:{{ ms_ext_mgmt_port }}/v1/servers/{{ uuid }}"
body: 'reachable={{ reachable }}'
when: uuid is defined
when: self_status