Search code examples
ansibleaemreplicationslingpublisher

Error deleting obsolete flush agents using ansible aem_agent module


Can anyone help me with the error deleting obsolete replication agents using the aem_agent module (https://github.com/lean-delivery/ansible-modules-aem/blob/master/aem_agent.py)?

I face an error:

"msg": "failed to delete agent: 405 - "

Here is a task:

- name: Remove dispatcher flush agents
  aem_agent:
    name: "{{ obsolete_dispatcher }}"
    state: absent
    folder: 'agents.publish'
    admin_user: '{{ admin_login }}'
    admin_password: '{{ admin_password }}'
    host: 'http://localhost'
    port: '4502'

From the error.log:

XX.XX.XXXX XX:XX:XX.XXX *ERROR* [127.0.0.1 [XXXXXXXXXXXXX] DELETE /etc/replication/agents.publish/ip-XX-XX-XXX-XXX-XX-XXXX-X-compute-internal-dispatcher HTTP/1.1] org.apache.sling.servlets.resolver.internal.SlingServletResolver handleError: Recursive invocation. Not further handling status 405(Method DELETE not supported)


Solution

  • The HTTP DELETE method isn't supported when you disable the WebDav bundles per the security checklist. You can either re-enable WebDAV or modify the code in the Ansible aemagent project to delete using the Sling POST servlet instead. The request would be a POST with parameter ":operation=delete" to the path.

    For examples, see the Sling documentation.