aboutsummaryrefslogblamecommitdiffhomepage
path: root/tasks/routes.yml
blob: 3ff25077350a740d658855483e21894e50e50044 (plain) (tree)
1
2
3
4
5
6
7
8
9

                      
                                                                             

                      
            
                                                  

                                         

                   
                                                                             


                                 
                                                  

                                    
                                                  




                         
                                                               

                  
                                                  
                    
                                                             
                                                    
- name: Get app routes
  uri:
    url: "{{ server.kong_app_admin_url }}/services/{{ service.name }}/routes"
    method: GET
    validate_certs: no
    headers:
      apikey: "{{ server.kong_app_admin_apikey }}"
  register: kong_app_service_routes_check

- name: Setup route
  uri:
    url: "{{ server.kong_app_admin_url }}/services/{{ service.name }}/routes"
    method: POST
    body: "{{ route | to_json }}"
    headers:
      apikey: "{{ server.kong_app_admin_apikey }}"
      Content-Type: application/json
    status_code: 201
  with_items: "{{ service.routes | default([]) }}"
  loop_control:
    loop_var: route

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