Note
This plugin is part of the community.general collection.
To install it use: ansible-galaxy collection install community.general.
To use it in a playbook, specify: community.general.redis.
The below requirements are needed on the local controller node that executes this lookup.
| Parameter | Choices/Defaults | Configuration | Comments |
|---|---|---|---|
| _terms string | list of keys to query | ||
| host string | Default: "127.0.0.1" | ini entries: [lookup_redis] env:ANSIBLE_REDIS_HOST | location of Redis host |
| port integer | Default: 6379 | ini entries: [lookup_redis] env:ANSIBLE_REDIS_PORT | port on which Redis is listening on |
| socket path | ini entries: [lookup_redis] env:ANSIBLE_REDIS_SOCKET | path to socket on which to query Redis, this option overrides host and port options when set. |
- name: query redis for somekey (default or configured settings used)
ansible.builtin.debug:
msg: "{{ lookup('community.general.redis', 'somekey') }}"
- name: query redis for list of keys and non-default host and port
ansible.builtin.debug:
msg: "{{ lookup('community.general.redis', item, host='myredis.internal.com', port=2121) }}"
loop: '{{list_of_redis_keys}}'
- name: use list directly
ansible.builtin.debug:
msg: "{{ lookup('community.general.redis', 'key1', 'key2', 'key3') }}"
- name: use list directly with a socket
ansible.builtin.debug:
msg: "{{ lookup('community.general.redis', 'key1', 'key2', socket='/var/tmp/redis.sock') }}"
Common return values are documented here, the following are the fields unique to this lookup:
| Key | Returned | Description |
|---|---|---|
| _raw list / elements=string | success | value(s) stored in Redis |
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/community/general/redis_lookup.html