+ ignore_errors: true
+ no_log: true
+ register: kong_plugin_update_st
+
+- name: Retry failed (deletion)
+ uri:
+ url: "{{ url }}"
+ method: "DELETE"
+ headers: "{{ headers }}"
+ status_code: 204
+ loop: "{{ kong_plugin_update_st.results }}"
+ loop_control:
+ loop_var: result
+ label: "{{ label_name }}"
+ vars:
+ method: "{{ result.invocation.module_args.method }}"
+ url: "{{ result.invocation.module_args.url }}"
+ headers: "{{ result.invocation.module_args.headers }}"
+ label_name: "{{ result.plugin.name }}"
+ when:
+ - kong_plugin_update_st is failed
+ - result is failed
+ - method == "PATCH"
+ no_log: true
+
+- name: Retry failed (recreation)
+ uri:
+ url: "{{ server.kong_app_admin_url }}/services/{{ service.name }}/plugins"
+ method: "POST"
+ body: "{{ body | to_json }}"
+ headers: "{{ headers }}"
+ status_code: 200,201
+ loop: "{{ kong_plugin_update_st.results }}"
+ loop_control:
+ loop_var: result
+ label: "{{ label_name }}"
+ vars:
+ method: "{{ result.invocation.module_args.method }}"
+ headers: "{{ result.invocation.module_args.headers }}"
+ body: "{{ result.invocation.module_args.body }}"
+ label_name: "{{ result.plugin.name }}"
+ when:
+ - kong_plugin_update_st is failed
+ - result is failed
+ - method == "PATCH"
+ no_log: true
+
+- name: Fail otherwise
+ fail:
+ msg: "This plugin {{ result.plugin.name }} failed to be created"
+ loop: "{{ kong_plugin_update_st.results }}"
+ loop_control:
+ loop_var: result
+ label: "{{ label_name }}"
+ vars:
+ method: "{{ result.invocation.module_args.method }}"
+ label_name: "{{ result.plugin.name }}"
+ when:
+ - kong_plugin_update_st is failed
+ - result is failed
+ - method == "POST"
+ no_log: true