Automate Clear Redis Cache Example with Ansible

If you have a large number of Redis servers running, clearing the cache for each one manually will takes time. To speed this process up, you can use a tool like Ansible to clear the cache on all your Redis servers at the same time:

ansible all -m command -a '/usr/bin/redis-cli flushall '

Running this command applies the flushall command to every server in your Ansible inventory file:

all – Lets you choose all the remote hosts in the Ansible inventory file.
-m – Lets you choose a module to execute.
-a – Provides an argument for the module.

In this case, the command module runs the flushall command with redis-cli.

Wagiman Wiryosukiro

Petani Sistem Informasi, tukang las plugin & themes Wordpress. Co-Founder Saat ini aktif sebagai Developer & kontributor di OpenMandriva Linux.

You may also like...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: