blob: df95f2ec27a1633d84d042dafa12b36ce762345e (
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
|
- name: Check if service exists
uri:
url: "{{ kong_app_admin_url }}/services/{{ kong_app_service_name }}"
method: GET
headers:
apikey: "{{ kong_app_admin_apikey }}"
status_code: 200,404
register: kong_app_check_service
- name: Update or Create service
uri:
url: "{{ kong_app_admin_url }}/services/{{ exists_service | ternary('', kong_app_service_name) }}"
method: "{{ exists_service | ternary('POST', 'PATCH') }}"
body: "{{ kong_app_service_body | to_json }}"
status_code: 200,201
headers:
apikey: "{{ kong_app_admin_apikey }}"
Content-Type: application/json
vars:
exists_service: "{{ kong_app_check_service.status|default(404) == 404 }}"
- name: Setup plugins
import_tasks: plugins.yml
- name: Setup routes
import_tasks: routes.yml
|