Cache Plugins — Ansible Documentation

- AnsibleFest
- Products
- Community
- Webinars & Training
- Blog

Documentation

Topics

- Cache Plugins
  - Enabling Cache Plugins
  - Using Cache Plugins
  - Plugin List

# Cache Plugins

Cache plugin implement a backend caching mechanism that allows Ansible to store gathered facts or inventory source data without the performance hit of retrieving them from source.

The default cache plugin is the memory plugin, which only caches the data for the current execution of Ansible. Other plugins with persistent storage are available to allow caching the data across runs.

## Enabling Cache Plugins

Only one cache plugin can be active at a time. You can enable a cache plugin in the Ansible configuration, either via environment variable:

    export ANSIBLE_CACHE_PLUGIN=jsonfile

or in the `ansible.cfg` file:

    [defaults]
    fact_caching=redis

You will also need to configure other settings specific to each plugin. Consult the individual plugin documentation or the Ansible configuration for more details.

A custom cache plugin is enabled by dropping it into a `cache_plugins` directory adjacent to your play, inside a role, or by putting it in one of the directory sources configured in ansible.cfg.

## Using Cache Plugins

Cache plugins are used automatically once they are enabled.

## Plugin List

You can use `ansible-doc -t cache -l` to see the list of available plugins. Use `ansible-doc -t cache <plugin name>` to see specific documentation and examples.

See also

Action Plugins
  Ansible Action plugins
Callback Plugins
  Ansible callback plugins
Connection Plugins
  Ansible connection plugins
Inventory Plugins
  Ansible inventory plugins
Shell Plugins
  Ansible Shell plugins
Strategy Plugins
  Ansible Strategy plugins
Vars Plugins
  Ansible Vars plugins
User Mailing List
  Have a question? Stop by the google group!
webchat.freenode.net
  #ansible IRC chat channel