From f2ce970ff8ff822909af55630ae0e4fe39d3b2ff Mon Sep 17 00:00:00 2001
From: rjshrjndrn <rjshrjndrn@gmail.com>
Date: Wed, 27 Nov 2019 15:58:25 +0530
Subject: [PATCH] cherry picking kube fixes for onboard apis

---
 ansible/roles/kong-api/tasks/main.yml | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/ansible/roles/kong-api/tasks/main.yml b/ansible/roles/kong-api/tasks/main.yml
index e38ef6876..cc1f54ce5 100644
--- a/ansible/roles/kong-api/tasks/main.yml
+++ b/ansible/roles/kong-api/tasks/main.yml
@@ -12,26 +12,11 @@
 - name: Copy kong api scripts
   copy: src=static-files/kong-api-scripts dest=/tmp mode=0755
 
-  #- name: "Ensure kong_admin_api_url is available before running the scripts"
-  #  uri:
-  #    url: "{{ kong_admin_api_url }}/status"
-  #    status_code: 200
-  #  register: result
-  #  until: result.status == 200
-  #  retries: 60
-  #  delay: 5
-
-- name: Extracting where the host in which api manager is running
-  command: bash -lc "sudo docker service ps api-manager_kong | grep Runn | head -n1 | awk '{print $4}'"
-  register: kong_running_host
-  delegate_to: "{{groups['swarm-manager-1'][0]}}"
-
-- set_fact:
-        kong_admin_api_url: "http://{{kong_running_host.stdout}}:8001"
-
 - name: waiting for 30 seconds for api manager to be fully functional
   pause:
     seconds: 30
 
+## Have to pass kong_api address as ip extravars
 - name: Run script to save apis
-  shell: "python /tmp/kong-api-scripts/kong_apis.py /tmp/kong_apis.json --kong-admin-api-url={{ kong_admin_api_url }}"
+  shell: "python /tmp/kong-api-scripts/kong_apis.py /tmp/kong_apis.json --kong-admin-api-url={{ kong_admin_api_url | d('localhost:31801') }}"
+  ignore_errors: yes
-- 
GitLab