blob: 6df4379d7e28ce6fa2f0e9383d9a384912979b13 [file] [log] [blame]
---
# tasks file for /Users/carlosfrias/apigee-workspace/opdk-workspace/apigee-opdk-setup-postgresql-add
- name: Set attributes if available
ignore_errors: true
set_fact:
pgmaster_group_name: "{{ pgmaster_group_name | default('pgmaster') }}"
pgstandby_group_name: "{{ pgstandby_group_name | default('pgstandby') }}"
master_uuid: "{{ hostvars[groups[pgmaster_group_name][0]].edge_ps_self.uUID }}"
standby_uuid: "{{ hostvars[groups[pgstandby_group_name][0]].edge_ps_self.uUID }}"
server_type: "{{ hostvars[groups[pgmaster_group_name][0]].edge_ps_self.type[0] }}"
- name: Assert that attributes are available.
assert:
that:
- "ax_group is defined and ax_group | trim | length > 0"
- "consumer_group is defined and consumer_group | trim | length > 0"
- "server_type is defined and server_type | trim | length > 0"
- "master_uuid is defined and uuid | trim | length > 0"
- "standby_uuid is defined and uuid | trim | length > 0"
msg: "Please provide the missing attribute"
- name: Construct uuid for master,standby
set_fact:
master_standby_uuid: "{{ master_uuid }},{{ standby_uuid }}"
when: master_standby_uuid is not defined
- name: Add postgres server
uri:
user: '{{ opdk_user_email }}'
password: '{{ opdk_user_pass }}'
method: POST
body_format: json
url: http://{{ local_mgmt_ip }}:8080/v1/analytics/groups/ax/{{ ax_group }}/servers?uuid={{ master_standby_uuid }}&type={{ server_type }}&force=true
- name: Add postgres to consumer groups
uri:
user: '{{ opdk_user_email }}'
password: '{{ opdk_user_pass }}'
method: POST
url: http://{{ local_mgmt_ip }}:8080/v1/analytics/groups/ax/{{ ax_group }}/consumer-groups/{{ consumer_group }}/datastores?uuid={{ master_standby_uuid }}
body_format: json