aboutsummaryrefslogtreecommitdiffhomepage
path: root/tasks/kong-app.yml
diff options
context:
space:
mode:
Diffstat (limited to 'tasks/kong-app.yml')
-rw-r--r--tasks/kong-app.yml29
1 files changed, 29 insertions, 0 deletions
diff --git a/tasks/kong-app.yml b/tasks/kong-app.yml
new file mode 100644
index 0000000..f94f044
--- /dev/null
+++ b/tasks/kong-app.yml
@@ -0,0 +1,29 @@
1- name: Check if service exists
2 uri:
3 url: "{{ kong_app_admin_url }}/services/{{ service.name }}"
4 method: GET
5 headers:
6 apikey: "{{ kong_app_admin_apikey }}"
7 status_code: 200,404
8 register: kong_app_check_service
9
10- name: Update or Create service
11 uri:
12 url: "{{ kong_app_admin_url }}/services/{{ exists_service | ternary('', service.name) }}"
13 method: "{{ exists_service | ternary('POST', 'PATCH') }}"
14 body: "{{ service_body | to_json }}"
15 status_code: 200,201
16 headers:
17 apikey: "{{ kong_app_admin_apikey }}"
18 Content-Type: application/json
19 vars:
20 exists_service: "{{ kong_app_check_service.status|default(404) == 404 }}"
21 service_body:
22 name: "{{ service.name }}"
23 url: "{{ service.url }}"
24
25- name: Setup plugins
26 import_tasks: plugins.yml
27
28- name: Setup routes
29 import_tasks: routes.yml