diff options
author | Gaëtan Duchaussois <gaetan.duchaussois@fretlink.com> | 2018-04-23 10:35:56 +0200 |
---|---|---|
committer | Gaëtan Duchaussois <gaetan.duchaussois@fretlink.com> | 2018-04-23 10:41:27 +0200 |
commit | 767c0e538b6b7c751784444fd6c676668e3a1b01 (patch) | |
tree | 6708c8474e2a2749f737817840b0f050d5236e44 /tasks/kong-app.yml | |
parent | 0682b86504faf606b9017bc82bdbabd3af237db6 (diff) | |
download | ansible-kong-app-767c0e538b6b7c751784444fd6c676668e3a1b01.tar.gz ansible-kong-app-767c0e538b6b7c751784444fd6c676668e3a1b01.tar.zst ansible-kong-app-767c0e538b6b7c751784444fd6c676668e3a1b01.zip |
setup an array of services
Diffstat (limited to 'tasks/kong-app.yml')
-rw-r--r-- | tasks/kong-app.yml | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tasks/kong-app.yml b/tasks/kong-app.yml index df95f2e..f94f044 100644 --- a/tasks/kong-app.yml +++ b/tasks/kong-app.yml | |||
@@ -1,6 +1,6 @@ | |||
1 | - name: Check if service exists | 1 | - name: Check if service exists |
2 | uri: | 2 | uri: |
3 | url: "{{ kong_app_admin_url }}/services/{{ kong_app_service_name }}" | 3 | url: "{{ kong_app_admin_url }}/services/{{ service.name }}" |
4 | method: GET | 4 | method: GET |
5 | headers: | 5 | headers: |
6 | apikey: "{{ kong_app_admin_apikey }}" | 6 | apikey: "{{ kong_app_admin_apikey }}" |
@@ -9,15 +9,18 @@ | |||
9 | 9 | ||
10 | - name: Update or Create service | 10 | - name: Update or Create service |
11 | uri: | 11 | uri: |
12 | url: "{{ kong_app_admin_url }}/services/{{ exists_service | ternary('', kong_app_service_name) }}" | 12 | url: "{{ kong_app_admin_url }}/services/{{ exists_service | ternary('', service.name) }}" |
13 | method: "{{ exists_service | ternary('POST', 'PATCH') }}" | 13 | method: "{{ exists_service | ternary('POST', 'PATCH') }}" |
14 | body: "{{ kong_app_service_body | to_json }}" | 14 | body: "{{ service_body | to_json }}" |
15 | status_code: 200,201 | 15 | status_code: 200,201 |
16 | headers: | 16 | headers: |
17 | apikey: "{{ kong_app_admin_apikey }}" | 17 | apikey: "{{ kong_app_admin_apikey }}" |
18 | Content-Type: application/json | 18 | Content-Type: application/json |
19 | vars: | 19 | vars: |
20 | exists_service: "{{ kong_app_check_service.status|default(404) == 404 }}" | 20 | exists_service: "{{ kong_app_check_service.status|default(404) == 404 }}" |
21 | service_body: | ||
22 | name: "{{ service.name }}" | ||
23 | url: "{{ service.url }}" | ||
21 | 24 | ||
22 | - name: Setup plugins | 25 | - name: Setup plugins |
23 | import_tasks: plugins.yml | 26 | import_tasks: plugins.yml |