Note
This module is part of the community.general collection (version 10.7.3).
You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install community.general. You need further requirements to be able to use this module, see Requirements for details.
To use it in a playbook, specify: community.general.redis_data_incr.
New in community.general 4.0.0
1. For specific increments use the increment_int and increment_float options.The below requirements are needed on the host that executes this module.
Parameter | Comments |
|---|---|
ca_certs string | Path to root certificates file. If not set and |
client_cert_file string added in community.general 9.3.0 | Path to the client certificate file. |
client_key_file string added in community.general 9.3.0 | Path to the client private key file. |
increment_float float | Float amount to increment the key by. This only works with keys that contain float values in their string representation. |
increment_int integer | Integer amount to increment the key by. |
key string / required | Database key. |
login_host string | Specify the target host running the database. Default: |
login_password string | Specify the password to authenticate with. Usually not used when target is localhost. |
login_port integer | Specify the port to connect to. Default: |
login_user string | Specify the user to authenticate with. Requires redis >= 3.4.0. |
tls boolean | Specify whether or not to use TLS for the connection. Choices:
|
validate_certs boolean | Specify whether or not to validate TLS certificates. This should only be turned off for personally controlled sites or with Choices:
|
Attribute | Support | Description |
|---|---|---|
check_mode | Support: partial For When using | Can run in |
diff_mode | Support: none | Will return details on what has changed (or possibly needs changing in |
Note
redis Python package on the remote host. You can install it with pip (pip install redis) or with a package manager. Information on the library can be found at https://github.com/andymccurdy/redis-py.See also
Set key value pairs in Redis.
Get value of key in Redis database.
Various redis commands, replica and flush.
- name: Increment integer key foo on localhost with no username and print new value
community.general.redis_data_incr:
login_host: localhost
login_password: supersecret
key: foo
increment_int: 1
register: result
- name: Print new value
debug:
var: result.value
- name: Increment float key foo by 20.4
community.general.redis_data_incr:
login_host: redishost
login_user: redisuser
login_password: somepass
key: foo
increment_float: '20.4'
Common return values are documented here, the following are the fields unique to this module:
Key | Description |
|---|---|
msg string | A short message. Returned: always Sample: |
value float | Incremented value of key. Returned: on success Sample: |
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/general/redis_data_incr_module.html