infinispan_cache
Configures Infinispan or Red Hat DataGrid caches at runtime.
This role allows to deploy a cache configuration from a provided xml file, or using ansible configuration, via infinispan hotrod or rest api; the configuration
happens at runtime, and will be distributed to all nodes of the cluster, so it is executed with the run_once
attribute. To deploy cache configuration statically
in the infinispan.xml server configuration, use the infinispan
role instead.
For more details, refer to:
Role Defaults
Variable |
Description |
Default |
---|---|---|
|
Alternate bind address for the daemon |
|
|
Path of infinispan rest api |
|
|
Choose rest api protocol |
|
|
Complete URL for connecting to infinispan rest api |
|
|
Alternate port for the service |
|
|
Server REST API/hotrod have TLS enabled |
|
|
Username that performs the API call |
|
|
XML declaration for the cache to deploy as string |
|
|
dict object with configuration for the cache to deploy |
|
where:
Role Variables
The following are a set of required variables for the role:
Variable |
Description |
Required |
---|---|---|
|
Password for the user performing the API call |
|
Dependencies
The role has currently no other dependency. Python lxml and jmespath libraries are needed on the host that executes this module. To install, from the collection root directory, run:
pip install -r requirements.txt
Example Playbook
The following are example playbooks that make use of the role to create Infinispan caches:
- hosts: [...]
collections:
- middleware_automation.infinispan
tasks:
- name: Include Infinispan cache role
include_role:
name: infinispan_cache
vars:
infinispan_deployer_password: changeme
infinispan_cache_xml: "{{lookup('file', 'templates/my_cache.xml') }}"
- hosts: [...]
collections:
- middleware_automation.infinispan
tasks:
- name: Include Infinispan cache role
include_role:
name: infinispan_cache
vars:
infinispan_deployer_password: changeme
infinispan_cache_xml: >
<local-cache name="testcachexml" statistics="true">
<encoding media-type="application/x-protostream"/>
</local-cache>
- hosts: [...]
collections:
- middleware_automation.infinispan
tasks:
- name: "infinispan cache role (yml)"
include_role:
name: ../../roles/infinispan_cache
vars:
infinispan_deployer_user: "supervisor"
infinispan_deployer_password: "remembertochangeme"
infinispan_cache_config:
name: configuredcache
template: replicated
mode: ASYNC
unreliable_return_values: true
transaction_mode: NONE
transaction_locking: PESSIMISTIC
memory_max_size: '100MB'
memory_when_full: 'REMOVE'
expiration_lifespan: 60000
expiration_max_idle: 10000
persistence: false
indexing: false
License
Apache License 2.0