redis – fetch data from Redis¶
New in version 2.5.
Synopsis¶
- This lookup returns a list of results from a Redis DB corresponding to a list of items given to it
Requirements¶
The below requirements are needed on the local master node that executes this lookup.
- redis (python library https://github.com/andymccurdy/redis-py/)
Parameters¶
Examples¶
- name: query redis for somekey (default or configured settings used)
debug: msg="{{ lookup('redis', 'somekey') }}"
- name: query redis for list of keys and non-default host and port
debug: msg="{{ lookup('redis', item, host='myredis.internal.com', port=2121) }}"
loop: '{{list_of_redis_keys}}'
- name: use list directly
debug: msg="{{ lookup('redis', 'key1', 'key2', 'key3') }}"
- name: use list directly with a socket
debug: msg="{{ lookup('redis', 'key1', 'key2', socket='/var/tmp/redis.sock') }}"
Return Values¶
Common return values are documented here, the following are the fields unique to this lookup:
Key | Returned | Description |
---|---|---|
_raw
-
|
value(s) stored in Redis
|
Status¶
- This lookup is not guaranteed to have a backwards compatible interface. [preview]
- This lookup is maintained by the Ansible Community. [community]
Authors¶
- Jan-Piet Mens (@jpmens) <jpmens(at)gmail.com>
- Ansible Core
Hint
If you notice any issues in this documentation, you can edit this document to improve it.
Hint
Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.