Update Ansible tasks for crowd-ehcache.xml after upgrading to Crowd 7.1 Data Center
Platform Notice: Data Center Only - This article only applies to Atlassian apps on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
This article explains how to update Ansible playbooks crowd-ehcache.xml after upgrading to 7.1 Data Center. It focuses on updating Ansible tasks, so they work with the new Ehcache 3 based XML structure and avoid startup failures caused by outdated cache configuration syntax.
When you upgrade to Crowd 7.1, Crowd changes its cache engine from Ehcache 2 to Ehcache 3, and the XML schema crowd-ehcache.xml changes significantly, including different element names, structure, attributes, and required values. If you have Ansible playbooks that edit crowd-ehcache.xml and they still assume the old Ehcache 2 schema, they may inject attributes that no longer exist, target elements that no longer exist, or use XPaths that no longer match anything. This can lead to XML validation errors (for example, type/union errors) and ultimately cause Crowd startup failures.
Solution
You need to update your Ansible tasks, not just the XML file, so they:
Stop targeting the old Ehcache 2 elements/attributes
Start targeting the new Ehcache 3 structure
Follow these steps in your playbook.
Remove Ansible tasks that target Ehcache 2 elements
Delete or update any Ansible tasks that:
Refer to <
defaultCache> elements, or attributes like:maxElementsInMemoryoverflowToDiskdiskExpiryThreadIntervalSeconds
Use XPaths such as:
//ehcache/defaultCache//ehcache/cache[@name='…']
These elements and attributes are part of the Ehcache 2 schema and are no longer valid in Ehcache 3.
Update Ansible tasks to work with the Ehcache 3 structure
Use Ansible’s xml module to target the new Ehcache 3 elements under ehcache:config.
The examples below show Ansible YAML that:
Edits
crowd-ehcache.xmlUses XPaths that match the Ehcache 3 schema
Sets attributes like
unitand the element’s numeric valueThe XPaths refer to elements in
crowd-ehcache.xml. The YAML itself is Ansible configuration, not XML.
- name: Update Crowd Ehcache default cache heap size (Crowd 7.0+)
xml:
path: "{{ crowd_role_install_directory }}/crowd-webapp/WEB-INF/classes/crowd-ehcache.xml"
xpath: "/ehcache:config/ehcache:cache-template[@name='default']/ehcache:resources/ehcache:heap"
backup: yes
pretty_print: yes
namespaces:
ehcache: ""
attribute: "{{ item.attr | default(omit) }}"
value: "{{ item.value }}"
loop:
- { attr: "unit", value: "entries" }
- { value: "8000" }
- name: Update Crowd Ehcache default disk configuration
xml:
path: "{{ crowd_role_install_directory }}/crowd-webapp/WEB-INF/classes/crowd-ehcache.xml"
xpath: "/ehcache:config/ehcache:cache-template[@name='default']/ehcache:resources/ehcache:disk"
backup: yes
pretty_print: yes
namespaces:
ehcache: ""
attribute: "{{ item.attr | default(omit) }}"
value: "{{ item.value }}"
loop:
- { attr: "unit", value: "MB" }
- { attr: "persistent", value: "true" }
- { value: "50" }
- name: Update Crowd Ehcache default Time to Live (TTL)
xml:
path: "{{ crowd_role_install_directory }}/crowd-webapp/WEB-INF/classes/crowd-ehcache.xml"
xpath: "/ehcache:config/ehcache:cache-template[@name='default']/ehcache:expiry/ehcache:ttl"
backup: yes
pretty_print: yes
namespaces:
ehcache: ""
attribute: "{{ item.attr | default(omit) }}"
value: "{{ item.value }}"
loop:
- { attr: "unit", value: "seconds" }
- { value: "300" }
- name: Update Crowd Ehcache token caches heap size
xml:
path: "{{ crowd_role_install_directory }}/crowd-webapp/WEB-INF/classes/crowd-ehcache.xml"
xpath: "/ehcache:config/ehcache:cache[@alias='{{ item.alias }}']/ehcache:resources/ehcache:heap"
backup: yes
pretty_print: yes
namespaces:
ehcache: ""
attribute: "{{ item.attr | default(omit) }}"
value: "{{ item.value }}"
loop:
- { alias: "com.atlassian.crowd.model.token.Token.identifier-hash-cache", attr: "unit", value: "entries" }
- { alias: "com.atlassian.crowd.model.token.Token.identifier-hash-cache", value: "4096" }
- { alias: "com.atlassian.crowd.model.token.Token.random-hash-cache", attr: "unit", value: "entries" }
- { alias: "com.atlassian.crowd.model.token.Token.random-hash-cache", value: "4096" }To adapt these examples:
Change
valueentries (e.g.8000,50,300) to match your desired cache sizes/TTL.Adjust
aliasvalues if your cache names differ from the defaults.
Validate your changes
After updating your Ansible tasks and running them:
Confirm that
crowd-ehcache.xmlis:Well‑formed XML
Using the Ehcache 3 structure (no
<defaultCache>elements, no Ehcache 2–only attributes)
Check that
ehcache:heapandehcache:diskelements both have:A
unitattributeA numeric value, for example:
<ehcache:disk unit="MB">50</ehcache:disk><ehcache:heap unit="entries">8000</ehcache:heap>Restart Crowd and verify it starts without XML parsing or cache-configuration errors.
Troubleshooting common errors
If you see errors similar to: 'is not a valid value of union type 'propertyOrPositiveInteger'
check the following in crowd-ehcache.xml:
Every
<ehcache:disk>and<ehcache:heap>element:Contains a numeric value (no empty elements)
Has a valid
unitattribute (for example,MB,entries)
Your Ansible tasks are not:
Creating empty elements
Setting attributes that are not part of the Ehcache 3 schema
Test all changes in a non-production environment before deploying to production.
Review the official Crowd and Ehcache 3 documentation for further details on supported configuration options.
Was this helpful?