From 1a33ca3184dbea838ea083a7cf026cf5884dc3f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Duchaussois?= Date: Fri, 20 Apr 2018 10:04:41 +0200 Subject: initial version --- ansible.cfg | 2 ++ defaults/main.yml | 4 ++++ handlers/main.yml | 2 ++ meta/main.yml | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tasks/kong-app.yml | 24 +++++++++++++++++++++++ tasks/main.yml | 5 +++++ tasks/plugins.yml | 28 +++++++++++++++++++++++++++ tasks/routes.yml | 32 ++++++++++++++++++++++++++++++ tests/inventory | 2 ++ tests/test.retry | 1 + tests/test.yml | 8 ++++++++ vars/main.yml | 4 ++++ 12 files changed, 169 insertions(+) create mode 100644 ansible.cfg create mode 100644 defaults/main.yml create mode 100644 handlers/main.yml create mode 100644 meta/main.yml create mode 100644 tasks/kong-app.yml create mode 100644 tasks/main.yml create mode 100644 tasks/plugins.yml create mode 100644 tasks/routes.yml create mode 100644 tests/inventory create mode 100644 tests/test.retry create mode 100644 tests/test.yml create mode 100644 vars/main.yml diff --git a/ansible.cfg b/ansible.cfg new file mode 100644 index 0000000..6462621 --- /dev/null +++ b/ansible.cfg @@ -0,0 +1,2 @@ +[defaults] +roles_path=../ diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..d75773b --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,4 @@ +--- +kong_app_admin_apikey: "" +kong_app_plugins: [] +kong_app_routes: [] diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..fd808d4 --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for ansible-kong-app \ No newline at end of file diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..e2b8be4 --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,57 @@ +galaxy_info: + author: FretLink team + description: Love and trucks + company: FretLink + + # If the issue tracker for your role is not on github, uncomment the + # next line and provide a value + # issue_tracker_url: http://example.com/issue/tracker + + # Some suggested licenses: + # - BSD (default) + # - MIT + # - GPLv2 + # - GPLv3 + # - Apache + # - CC-BY + license: TBD + + min_ansible_version: 2.4 + + # If this a Container Enabled role, provide the minimum Ansible Container version. + # min_ansible_container_version: + + # Optionally specify the branch Galaxy will use when accessing the GitHub + # repo for this role. During role install, if no tags are available, + # Galaxy will use this branch. During import Galaxy will access files on + # this branch. If Travis integration is configured, only notifications for this + # branch will be accepted. Otherwise, in all cases, the repo's default branch + # (usually master) will be used. + #github_branch: + + # + # platforms is a list of platforms, and each platform has a name and a list of versions. + # + # platforms: + # - name: Fedora + # versions: + # - all + # - 25 + # - name: SomePlatform + # versions: + # - all + # - 1.0 + # - 7 + # - 99.99 + + galaxy_tags: [] + # List tags for your role here, one per line. A tag is a keyword that describes + # and categorizes the role. Users find roles by searching for tags. Be sure to + # remove the '[]' above, if you add tags to this list. + # + # NOTE: A tag is limited to a single word comprised of alphanumeric characters. + # Maximum 20 tags per role. + +dependencies: [] + # List your role dependencies here, one per line. Be sure to remove the '[]' above, + # if you add dependencies to this list. diff --git a/tasks/kong-app.yml b/tasks/kong-app.yml new file mode 100644 index 0000000..d50c193 --- /dev/null +++ b/tasks/kong-app.yml @@ -0,0 +1,24 @@ +- 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/{{ kong_app_service_name }}" +# method: "{{ (kong_app_check_service.status_code == 404) | ternary ('POST', 'PATCH') }}" +# body: "{{ kong_app_service_body | to_json }}" +# headers: +# apikey: "{{ kong_app_admin_apikey }}" +# Content-Type: application/json +# status_code: 200,201 + +- name: Setup plugins + import_tasks: plugins.yml + +- name: Setup routes + import_tasks: routes.yml diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..4bb562f --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,5 @@ +--- +- name: Include kong-app tasks + import_tasks: kong-app.yml + tags: + - kong-app diff --git a/tasks/plugins.yml b/tasks/plugins.yml new file mode 100644 index 0000000..c8f165c --- /dev/null +++ b/tasks/plugins.yml @@ -0,0 +1,28 @@ +- name: Get plugins + uri: + url: "{{ kong_app_admin_url }}/services/{{ kong_app_service_name }}/plugins" + method: GET + validate_certs: no + register: kong_app_service_plugins_check + +- name: Set plugins facts + set_fact: + kong_app_current_plugins: "{{ kong_app_service_plugins_check.json | default('{}') | from_json }}" + +- name: Setup plugin {{ plugin.name }} + uri: + url: "{{ kong_app_admin_url }}/services/{{ kong_app_service_name }}/plugins" + method: "{{ (current_config == {}) | ternary ('POST', 'PATCH') }}" + body: "{{ plugin | combine(current_body) | to_json }}" + headers: + apikey: "{{ kong_app_admin_apikey }}" + Content-Type: application/json + status_code: 200,201 + with_items: "{{ kong_app_plugins }}" + loop_control: + loop_var: plugin + vars: + current_config: "{{ kong_app_current_plugins.data | selectattr('name', plugin.name) | first |default({}) }}" + current_id_hash: + id: "{{ current_config.id | default('')}}" + current_body: "{{ (current_id_hash.id == '') | ternary({}, current_id_hash) }}" diff --git a/tasks/routes.yml b/tasks/routes.yml new file mode 100644 index 0000000..1a9f6db --- /dev/null +++ b/tasks/routes.yml @@ -0,0 +1,32 @@ +- name: Get app routes + uri: + url: "{{ kong_app_admin_url }}/services/{{ kong_app_service_name }}/routes" + method: GET + validate_certs: no + register: kong_app_service_routes_check + +- name: Set routes facts + set_fact: + kong_app_current_routes: "{{ kong_app_service_routes_check.json |default('{\"data\": []}') | from_json }}" + +- 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 }}/services/routes/{{ item.id }}" + method: DELETE + headers: + apikey: "{{ kong_app_admin_apikey }}" + status_code: 204 + with_items: "{{ kong_app_current_routes.data }}" diff --git a/tests/inventory b/tests/inventory new file mode 100644 index 0000000..878877b --- /dev/null +++ b/tests/inventory @@ -0,0 +1,2 @@ +localhost + diff --git a/tests/test.retry b/tests/test.retry new file mode 100644 index 0000000..2fbb50c --- /dev/null +++ b/tests/test.retry @@ -0,0 +1 @@ +localhost diff --git a/tests/test.yml b/tests/test.yml new file mode 100644 index 0000000..fb0d9b8 --- /dev/null +++ b/tests/test.yml @@ -0,0 +1,8 @@ +--- +- hosts: localhost + remote_user: root + roles: + - role: ansible-kong-app + kong_app_admin_url: http://127.0.0.1:8000 + kong_app_service_name: toto + kong_app_service_url: http://example.com diff --git a/vars/main.yml b/vars/main.yml new file mode 100644 index 0000000..02f5cd6 --- /dev/null +++ b/vars/main.yml @@ -0,0 +1,4 @@ +--- +kong_app_service_body: + name: "{{ kong_app_service_name }}" + url: "{{ kong_app_service_url }}" -- cgit v1.2.3 From ad5e125af59a34020943158999564af4f3a41a59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Duchaussois?= Date: Fri, 20 Apr 2018 12:14:40 +0200 Subject: After testing --- meta/main.yml | 4 ++-- tasks/kong-app.yml | 18 +++++++++--------- tasks/plugins.yml | 16 +++++++--------- tasks/routes.yml | 10 ++++------ 4 files changed, 22 insertions(+), 26 deletions(-) diff --git a/meta/main.yml b/meta/main.yml index e2b8be4..a2ae975 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,7 +1,7 @@ galaxy_info: author: FretLink team description: Love and trucks - company: FretLink + company: FretLink # If the issue tracker for your role is not on github, uncomment the # next line and provide a value @@ -14,7 +14,7 @@ galaxy_info: # - GPLv3 # - Apache # - CC-BY - license: TBD + license: TBD min_ansible_version: 2.4 diff --git a/tasks/kong-app.yml b/tasks/kong-app.yml index d50c193..e162c09 100644 --- a/tasks/kong-app.yml +++ b/tasks/kong-app.yml @@ -7,15 +7,15 @@ status_code: 200,404 register: kong_app_check_service -#- name: Update or Create service -# uri: -# url: "{{ kong_app_admin_url }}/services/{{ kong_app_service_name }}" -# method: "{{ (kong_app_check_service.status_code == 404) | ternary ('POST', 'PATCH') }}" -# body: "{{ kong_app_service_body | to_json }}" -# headers: -# apikey: "{{ kong_app_admin_apikey }}" -# Content-Type: application/json -# status_code: 200,201 +- name: Update or Create service + uri: + url: "{{ kong_app_admin_url }}/services/{{ (kong_app_check_service.status == 404) | ternary('', kong_app_service_name) }}" + method: "{{ (kong_app_check_service.status == 404) | ternary('POST', 'PATCH') }}" + body: "{{ kong_app_service_body | to_json }}" + status_code: 200,201 + headers: + apikey: "{{ kong_app_admin_apikey }}" + Content-Type: application/json - name: Setup plugins import_tasks: plugins.yml diff --git a/tasks/plugins.yml b/tasks/plugins.yml index c8f165c..84f3d49 100644 --- a/tasks/plugins.yml +++ b/tasks/plugins.yml @@ -3,16 +3,14 @@ url: "{{ kong_app_admin_url }}/services/{{ kong_app_service_name }}/plugins" method: GET validate_certs: no + headers: + apikey: "{{ kong_app_admin_apikey }}" register: kong_app_service_plugins_check -- name: Set plugins facts - set_fact: - kong_app_current_plugins: "{{ kong_app_service_plugins_check.json | default('{}') | from_json }}" - -- name: Setup plugin {{ plugin.name }} +- name: Setup plugin uri: - url: "{{ kong_app_admin_url }}/services/{{ kong_app_service_name }}/plugins" - method: "{{ (current_config == {}) | ternary ('POST', 'PATCH') }}" + url: "{{ kong_app_admin_url }}/{{ (current_config.id == '') | ternary('services/' ~ kong_app_service_name ~ '/plugins','plugins/' ~ current_config.id) }}" + method: "{{ (current_config.id == '') | ternary ('POST', 'PATCH') }}" body: "{{ plugin | combine(current_body) | to_json }}" headers: apikey: "{{ kong_app_admin_apikey }}" @@ -22,7 +20,7 @@ loop_control: loop_var: plugin vars: - current_config: "{{ kong_app_current_plugins.data | selectattr('name', plugin.name) | first |default({}) }}" + current_config: "{{ kong_app_service_plugins_check.json.data | selectattr('name', 'equalto', plugin.name) | first |default({\"id\": ''}) }}" current_id_hash: - id: "{{ current_config.id | default('')}}" + id: "{{ current_config.id }}" current_body: "{{ (current_id_hash.id == '') | ternary({}, current_id_hash) }}" diff --git a/tasks/routes.yml b/tasks/routes.yml index 1a9f6db..bbcdb76 100644 --- a/tasks/routes.yml +++ b/tasks/routes.yml @@ -3,12 +3,10 @@ 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: Set routes facts - set_fact: - kong_app_current_routes: "{{ kong_app_service_routes_check.json |default('{\"data\": []}') | from_json }}" - - name: Setup route uri: url: "{{ kong_app_admin_url }}/services/{{ kong_app_service_name }}/routes" @@ -24,9 +22,9 @@ - name: Delete old routes uri: - url: "{{ kong_app_admin_url }}/services/routes/{{ item.id }}" + url: "{{ kong_app_admin_url }}/routes/{{ item.id }}" method: DELETE headers: apikey: "{{ kong_app_admin_apikey }}" status_code: 204 - with_items: "{{ kong_app_current_routes.data }}" + with_items: "{{ kong_app_service_routes_check.json.data }}" -- cgit v1.2.3 From d213edd127a145821e419e80104a838da421e7ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Duchaussois?= Date: Fri, 20 Apr 2018 14:40:33 +0200 Subject: add travis configuration and fix tests --- .travis.yml | 32 ++++++++++++++++++++++++++++++++ tasks/kong-app.yml | 6 ++++-- tasks/plugins.yml | 6 ++++-- tasks/routes.yml | 1 + tests/inventory | 2 +- 5 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..812d0fe --- /dev/null +++ b/.travis.yml @@ -0,0 +1,32 @@ +--- +language: python +python: "2.7" + +# Use the new container infrastructure +sudo: false + +# Install ansible +addons: + apt: + packages: + - python-pip + +install: + # Install ansible + - pip install ansible + - pip install ansible-lint + + # Check ansible version + - ansible --version + + # Create ansible.cfg with correct roles_path + - printf '[defaults]\nroles_path=../' >ansible.cfg + +script: + # Basic role syntax check + - ansible-playbook tests/test.yml -i tests/inventory --syntax-check + - ansible-lint . + - ansible-playbook tests/test.yml -i tests/inventory -C -D + +notifications: + webhooks: https://galaxy.ansible.com/api/v1/notifications/ diff --git a/tasks/kong-app.yml b/tasks/kong-app.yml index e162c09..df95f2e 100644 --- a/tasks/kong-app.yml +++ b/tasks/kong-app.yml @@ -9,13 +9,15 @@ - name: Update or Create service uri: - url: "{{ kong_app_admin_url }}/services/{{ (kong_app_check_service.status == 404) | ternary('', kong_app_service_name) }}" - method: "{{ (kong_app_check_service.status == 404) | ternary('POST', 'PATCH') }}" + 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 diff --git a/tasks/plugins.yml b/tasks/plugins.yml index 84f3d49..c03bca7 100644 --- a/tasks/plugins.yml +++ b/tasks/plugins.yml @@ -9,8 +9,8 @@ - name: Setup plugin uri: - url: "{{ kong_app_admin_url }}/{{ (current_config.id == '') | ternary('services/' ~ kong_app_service_name ~ '/plugins','plugins/' ~ current_config.id) }}" - method: "{{ (current_config.id == '') | ternary ('POST', 'PATCH') }}" + url: "{{ kong_app_admin_url }}/{{ exists_plugin | ternary('services/' ~ kong_app_service_name ~ '/plugins','plugins/' ~ current_config.id) }}" + method: "{{ exists_plugin | ternary ('POST', 'PATCH') }}" body: "{{ plugin | combine(current_body) | to_json }}" headers: apikey: "{{ kong_app_admin_apikey }}" @@ -24,3 +24,5 @@ current_id_hash: id: "{{ current_config.id }}" current_body: "{{ (current_id_hash.id == '') | ternary({}, current_id_hash) }}" + exists_plugin: "{{ current_id_hash.id == '' }}" + when: not kong_app_service_plugins_check|skipped diff --git a/tasks/routes.yml b/tasks/routes.yml index bbcdb76..d4d912f 100644 --- a/tasks/routes.yml +++ b/tasks/routes.yml @@ -28,3 +28,4 @@ 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 diff --git a/tests/inventory b/tests/inventory index 878877b..49d4fe2 100644 --- a/tests/inventory +++ b/tests/inventory @@ -1,2 +1,2 @@ -localhost +localhost ansible_connection=local -- cgit v1.2.3 From 0682b86504faf606b9017bc82bdbabd3af237db6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Duchaussois?= Date: Fri, 20 Apr 2018 15:00:52 +0200 Subject: fix deprecation warning --- tasks/plugins.yml | 2 +- tasks/routes.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/plugins.yml b/tasks/plugins.yml index c03bca7..f096d4b 100644 --- a/tasks/plugins.yml +++ b/tasks/plugins.yml @@ -25,4 +25,4 @@ id: "{{ current_config.id }}" current_body: "{{ (current_id_hash.id == '') | ternary({}, current_id_hash) }}" exists_plugin: "{{ current_id_hash.id == '' }}" - when: not kong_app_service_plugins_check|skipped + when: not kong_app_service_plugins_check is skipped diff --git a/tasks/routes.yml b/tasks/routes.yml index d4d912f..4581e8c 100644 --- a/tasks/routes.yml +++ b/tasks/routes.yml @@ -28,4 +28,4 @@ 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 + when: not kong_app_service_routes_check is skipped -- cgit v1.2.3 From 767c0e538b6b7c751784444fd6c676668e3a1b01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Duchaussois?= Date: Mon, 23 Apr 2018 10:35:56 +0200 Subject: setup an array of services --- README.md | 29 +++++++++++++++-------------- defaults/main.yml | 3 +-- tasks/kong-app.yml | 9 ++++++--- tasks/main.yml | 5 ++++- tasks/plugins.yml | 6 +++--- tasks/routes.yml | 6 +++--- tests/test.retry | 1 - vars/main.yml | 3 --- 8 files changed, 32 insertions(+), 30 deletions(-) delete mode 100644 tests/test.retry diff --git a/README.md b/README.md index 5cf5f18..074e830 100644 --- a/README.md +++ b/README.md @@ -13,16 +13,17 @@ Role Variables * `kong_app_admin_url` the kong admin url (mandatory). * `kong_app_admin_apikey` the apikey to use kong admin api. Default to "" -* `kong_app_service_name` the nameof the service to create for this app, mandatory -* `kong_app_service_url` the url of the backend of the app, mandatory -* `kong_app_plugins` An array of plugins to activate with their name and config in a dict - * `name` - * `config` -* `kong_app_routes` An array of routes to create for this app. - * `hosts` - * `paths` - * `protocols` - * `methods` +* `kong_services` an array of services to setup (default to []) + * `name` the name of the service to create for this app, mandatory + * `url` the url of the backend of the app, mandatory + * `plugins` An array of plugins to activate with their name and config in a dict + * `name` + * `config` + * `routes` An array of routes to create for this service. + * `hosts` + * `paths` + * `protocols` + * `methods` Dependencies ------------ @@ -35,10 +36,10 @@ Example Playbook - hosts: localhost roles: - { role: kong-app, kong_app_admin_url: http://localhost:8001, - kong_app_service_name: example, - kong_app_service_url: http://example.com, - kong_app_plugins: [], - kong_app_routes: [ { hosts: [my.kong.example], paths: [/] } ] + kong_app_services: [ name:example, + url: http://example.com, + plugins: [], + routes: [ { hosts: [my.kong.example], paths: [/] } ]] } License diff --git a/defaults/main.yml b/defaults/main.yml index d75773b..e2de8f5 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,4 +1,3 @@ --- kong_app_admin_apikey: "" -kong_app_plugins: [] -kong_app_routes: [] +kong_services: [] 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 @@ - name: Check if service exists uri: - url: "{{ kong_app_admin_url }}/services/{{ kong_app_service_name }}" + url: "{{ kong_app_admin_url }}/services/{{ service.name }}" method: GET headers: apikey: "{{ kong_app_admin_apikey }}" @@ -9,15 +9,18 @@ - name: Update or Create service uri: - url: "{{ kong_app_admin_url }}/services/{{ exists_service | ternary('', kong_app_service_name) }}" + url: "{{ kong_app_admin_url }}/services/{{ exists_service | ternary('', service.name) }}" method: "{{ exists_service | ternary('POST', 'PATCH') }}" - body: "{{ kong_app_service_body | to_json }}" + body: "{{ 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 }}" + service_body: + name: "{{ service.name }}" + url: "{{ service.url }}" - name: Setup plugins import_tasks: plugins.yml diff --git a/tasks/main.yml b/tasks/main.yml index 4bb562f..4bd42c8 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,5 +1,8 @@ --- - name: Include kong-app tasks - import_tasks: kong-app.yml + include_tasks: kong-app.yml tags: - kong-app + with_items: "{{ kong_services }}" + loop_control: + loop_var: service diff --git a/tasks/plugins.yml b/tasks/plugins.yml index f096d4b..3ae0fbe 100644 --- a/tasks/plugins.yml +++ b/tasks/plugins.yml @@ -1,6 +1,6 @@ - name: Get plugins uri: - url: "{{ kong_app_admin_url }}/services/{{ kong_app_service_name }}/plugins" + url: "{{ kong_app_admin_url }}/services/{{ service.name }}/plugins" method: GET validate_certs: no headers: @@ -9,14 +9,14 @@ - name: Setup plugin uri: - url: "{{ kong_app_admin_url }}/{{ exists_plugin | ternary('services/' ~ kong_app_service_name ~ '/plugins','plugins/' ~ current_config.id) }}" + url: "{{ kong_app_admin_url }}/{{ exists_plugin | ternary('services/' ~ service.name ~ '/plugins','plugins/' ~ current_config.id) }}" method: "{{ exists_plugin | ternary ('POST', 'PATCH') }}" body: "{{ plugin | combine(current_body) | to_json }}" headers: apikey: "{{ kong_app_admin_apikey }}" Content-Type: application/json status_code: 200,201 - with_items: "{{ kong_app_plugins }}" + with_items: "{{ service.plugins | default([]) }}" loop_control: loop_var: plugin vars: diff --git a/tasks/routes.yml b/tasks/routes.yml index 4581e8c..881fc96 100644 --- a/tasks/routes.yml +++ b/tasks/routes.yml @@ -1,6 +1,6 @@ - name: Get app routes uri: - url: "{{ kong_app_admin_url }}/services/{{ kong_app_service_name }}/routes" + url: "{{ kong_app_admin_url }}/services/{{ service.name }}/routes" method: GET validate_certs: no headers: @@ -9,14 +9,14 @@ - name: Setup route uri: - url: "{{ kong_app_admin_url }}/services/{{ kong_app_service_name }}/routes" + url: "{{ kong_app_admin_url }}/services/{{ 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 }}" + with_items: "{{ service.routes | default([]) }}" loop_control: loop_var: route diff --git a/tests/test.retry b/tests/test.retry deleted file mode 100644 index 2fbb50c..0000000 --- a/tests/test.retry +++ /dev/null @@ -1 +0,0 @@ -localhost diff --git a/vars/main.yml b/vars/main.yml index 02f5cd6..ed97d53 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,4 +1 @@ --- -kong_app_service_body: - name: "{{ kong_app_service_name }}" - url: "{{ kong_app_service_url }}" -- cgit v1.2.3