X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tasks%2Fplugins.yml;h=90a038667db479d8adf82c84f8dac338403b929a;hb=e475469f4a5dc05df98cbb856d9d9328fc73c100;hp=164f6f255704b941b784a375ca5f5432f09c4e6d;hpb=082ff4cbc61abd4675158056d1b74317aacb173d;p=github%2Ffretlink%2Fansible-kong-app.git diff --git a/tasks/plugins.yml b/tasks/plugins.yml index 164f6f2..90a0386 100644 --- a/tasks/plugins.yml +++ b/tasks/plugins.yml @@ -26,7 +26,7 @@ current_config: "{{ plugins_list | selectattr('name', 'equalto', plugin.name) | first |default({\"id\": ''}) }}" current_id_hash: id: "{{ current_config.id }}" - current_body: "{{ not current_id_hash.id | ternary({}, current_id_hash) }}" + current_body: "{{ (not current_id_hash.id) | ternary({}, current_id_hash) }}" exists_plugin: "{{ not current_id_hash.id }}" when: not kong_app_service_plugins_check is skipped ignore_errors: true @@ -58,7 +58,7 @@ uri: url: "{{ server.kong_app_admin_url }}/services/{{ service.name }}/plugins" method: "POST" - body: "{{ body }}" + body: "{{ body | to_json }}" headers: "{{ headers }}" status_code: 200,201 loop: "{{ kong_plugin_update_st.results }}" @@ -76,6 +76,22 @@ - method == "PATCH" no_log: true +- name: Give info on errors + debug: + msg: "{{ info }}" + loop: "{{ kong_plugin_update_st.results }}" + loop_control: + label: "{{ item.plugin.name }}" + when: + - kong_plugin_update_st is failed + - item is failed + - item.plugin is defined + - item.plugin.name is defined + - item.json is defined + - item.json.message is defined + vars: + info: "{{ item.json.message }}" + - name: Fail otherwise fail: msg: "This plugin {{ result.plugin.name }} failed to be created"