aboutsummaryrefslogtreecommitdiffhomepage
path: root/tasks/routes.yml
blob: d4d912fdbd24b3ed1d1ac447f5066c934cba77ae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
- name: Get app routes
  uri:
    url: "{{ kong_app_admin_url }}/services/{{ kong_app_service_name }}/routes"
    method: GET
    validate_certs: no
    headers:
      apikey: "{{ kong_app_admin_apikey }}"
  register: kong_app_service_routes_check

- name: Setup route
  uri:
    url: "{{ kong_app_admin_url }}/services/{{ kong_app_service_name }}/routes"
    method: POST
    body: "{{ route | to_json }}"
    headers:
      apikey: "{{ kong_app_admin_apikey }}"
      Content-Type: application/json
    status_code: 201
  with_items: "{{ kong_app_routes }}"
  loop_control:
    loop_var: route

- name: Delete old routes
  uri:
    url: "{{ kong_app_admin_url }}/routes/{{ item.id }}"
    method: DELETE
    headers:
      apikey: "{{ kong_app_admin_apikey }}"
    status_code: 204
  with_items: "{{ kong_app_service_routes_check.json.data }}"
  when: not kong_app_service_routes_check|skipped