ansible / ansible.builtin / v2.9.4 / lookup / redis fetch data from Redis | "added in version" 2.5 of ansible.builtin" Authors: Jan-Piet Mens (@jpmens) <jpmens(at)gmail.com>, Ansible Coreansible.builtin.redis (v2.9.4) — lookup
pip
Install with pip install ansible==2.9.4
This lookup returns a list of results from a Redis DB corresponding to a list of items given to it
- 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') }}"
host: default: 127.0.0.1 description: location of Redis host env: - name: ANSIBLE_REDIS_HOST ini: - key: host section: lookup_redis port: default: 6379 description: port on which Redis is listening on env: - name: ANSIBLE_REDIS_PORT ini: - key: port section: lookup_redis type: int _terms: description: list of keys to query socket: description: path to socket on which to query Redis, this option overrides host and port options when set. env: - name: ANSIBLE_REDIS_SOCKET ini: - key: socket section: lookup_redis type: path
_raw: description: value(s) stored in Redis