diff --git a/ansible/roles/kong-consumer/tasks/main.yml b/ansible/roles/kong-consumer/tasks/main.yml index 155fa8ac137a0a67105ef6e5cc8aa0e95a9cc911..bebf3498b2353e1cbac2650f6230db569659c7fd 100644 --- a/ansible/roles/kong-consumer/tasks/main.yml +++ b/ansible/roles/kong-consumer/tasks/main.yml @@ -24,13 +24,12 @@ # 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]}}" +- name: Getting private lb ip + command: kubectl get svc -n istio-system ingressgateway-private -o jsonpath='{.status.loadBalancer.ingress[0].ip}' + register: private_lb_ip - set_fact: - kong_admin_api_url: "http://{{kong_running_host.stdout}}:8001" + kong_admin_api_url: "http://{{private_lb_ip.stdout}}/admin-api" - name: Run script to save consumers shell: "python /tmp/kong-api-scripts/kong_consumers.py /tmp/kong_consumers.json --kong-admin-api-url={{ kong_admin_api_url }}" @@ -56,5 +55,8 @@ ignore_errors: yes - name: remove the file - file: path=~/jwt_token.txt state=absent + file: path={{ item }} state=absent ignore_errors: yes + with_items: + - /tmp/jwt_token_output.txt + - /tmp/jwt_token.txt