#
# Custom Error Pages
#

- name: error pages | create errorpages directory
  file:
    path: "{{ tomcat_catalina_home }}/webapps/ROOT/errorpages/"
    state: directory
    owner: "{{ tomcat_root_user }}"
    group: "{{ tomcat_system_group }}"
    mode: "u=rwx,g=rx,o="

- name: error pages | download custom erropages for Tomcat
  get_url:
    url: "{{ tomcat_custom_error_pages_url }}/{{ item }}.html"
    dest: "{{ tomcat_catalina_home }}/webapps/ROOT/errorpages/{{ item }}.jsp"
  with_items:
  - "{{ tomcat_custom_error_pages }}"

- name: "modify 'web.xml' for custom error pages"
  xml:
    file: "{{ tomcat_catalina_base }}/conf/web.xml"
    xpath: /web-app/ 
    add_children: "{{ item }}"
    input_type: xml
  with_items:
  - "{{ tomcat_custom_error_pages_xml }}"

#
# Custom Error Pages
#

- name: error pages | create errorpages directory
  file:
    path: "{{ tomcat_catalina_home }}/webapps/ROOT/errorpages/"
    state: directory
    owner: "{{ tomcat_root_user }}"
    group: "{{ tomcat_system_group }}"
    mode: "u=rwx,g=rx,o="

- name: error pages | download custom erropages for Tomcat
  get_url:
    url: "{{ tomcat_custom_error_pages_url }}/{{ item }}.html"
    dest: "{{ tomcat_catalina_home }}/webapps/ROOT/errorpages/{{ item }}.jsp"
  with_items:
  - "{{ tomcat_custom_error_pages }}"

- name: "modify 'web.xml' for custom error pages"
  xml:
    file: "{{ tomcat_catalina_base }}/conf/web.xml"
    xpath: "/web-app"
    add_children: "{{ item }}"
    input_type: xml
  with_items:
  - "{{ tomcat_custom_error_pages_xml }}"

Fix ustom errorpage XML node
Fix ustom errorpage XML node
