blob: 1476102d1d59bff786d352d9cba6fdd0bafa1c07 [file] [log] [blame]
---
- name: Playbook to remove a message processor
hosts: "{{ target_hosts }}"
gather_facts: no
vars_files:
- '~/.apigee-secure/credentials.yml'
roles:
- { role: apigee-opdk-server-self, server_types: ['mp'], tags: ['self'] }
tasks:
- name: Set attributes if available
ignore_errors: true
set_fact:
uuid: "{{ edge_mp_self.uUID }}"
server_type: "{{ edge_mp_self.type[0] }}"
- name: Assert variables exist
assert:
that:
- region is defined and region | trim | length > 0
- pod_name is defined and pod_name | trim | length > 0
- uuid is defined and uuid | trim | length > 0
msg: "Please provide the missing attribute"
- name: Deregister message processor from the org's environments
uri:
url: http://10.142.0.11:8080/v1/o/rbc-apigee/e/sb/servers
method: POST
user: opdk@apigee.com
password: Apigee123!
header:
Content-Type: 'application/x-www-form-urlencoded'
body:
uuid: '{{ uuid }}'
region: dc-1
pod: test-pod
action: remove
#
# - name: Deregister message processor from the org's environments
# uri:
# url: http://{{ local_mgmt_ip }}:8080/v1/o/{{ org_name }}/e/{{ env_name }}/servers
# method: POST
# user: '{{ opdk_user_email }}'
# password: '{{ opdk_user_pass }}'
# header:
# Content-Type: 'application/x-www-form-urlencoded'
# body:
# uuid: '{{ uuid }}'
# region: '{{ region }}'
# pod: '{{ pod_name }}'
# action: remove
- name: Deregister server's type
uri:
url: http://{{ local_mgmt_ip }}:8080/v1/servers
method: POST
user: '{{ opdk_user_email }}'
password: '{{ opdk_user_pass }}'
HEADER_Content-Type: 'application/x-www-form-urlencoded'
body:
uuid: '{{ uuid }}'
region: '{{ region }}'
pod: '{{ pod_name }}'
type: '{{ server_type }}'
action: remove
- name: Delete the server
uri:
url: http://{{ local_mgmt_ip }}:8080/v1/servers/{{ uuid }}
method: DELETE
user: '{{ opdk_user_email }}'
password: '{{ opdk_user_pass }}'