geerlingguy.redis

Ansible Role: Redis

CI

This role installs Redis on Linux systems.

Requirements

For RedHat-based distributions, you need the EPEL repository. You can add the role geerlingguy.repo-epel to ensure EPEL is set up.

Role Variables

redis_enablerepo: epel

(This is for RHEL/CentOS only) This is the repository used to install Redis.

Here are some available variables with their default values (see defaults/main.yml):

redis_port: 6379
redis_bind_interface: 127.0.0.1

Use these to set the port and interface Redis will listen on. Setting the interface to 0.0.0.0 allows it to listen on all interfaces.

redis_unixsocket: ''

If specified, Redis will also use a local Unix socket for connections.

redis_timeout: 300

This closes a connection after N seconds of inactivity. Set it to 0 to turn off the timeout.

redis_loglevel: "notice"
redis_logfile: /var/log/redis/redis-server.log

These set the logging level and where to log (valid levels are debug, verbose, notice, and warning).

redis_databases: 16

This sets the number of databases Redis will use.

# To disable persistence (saving data to disk), set this to an empty set.
redis_save:
  - 900 1
  - 300 10
  - 60 10000

This is for configuring when to save snapshots of the database to disk based on time and write operations.

redis_rdbcompression: "yes"
redis_dbfilename: dump.rdb
redis_dbdir: /var/lib/redis

These control database compression and where the database files are stored.

redis_maxmemory: 0

This limits memory usage to a specific amount in bytes. Set it to 0 for unlimited memory.

redis_maxmemory_policy: "noeviction"

This defines the approach used to keep memory usage below the limit (if set). Check Using Redis as an LRU cache for more information.

redis_maxmemory_samples: 5

This specifies how many samples Redis should use to estimate LRU (Least Recently Used).

redis_appendonly: "no"

If enabled, this option improves data durability but may slow down performance.

redis_appendfsync: "everysec"

This controls how often data is flushed to disk, with options being always, everysec, or no.

# Add additional files for local configuration/overrides.
redis_includes: []

Add paths for extra configuration files here.

The name of the Redis package for installation through your package manager. It defaults to redis-server on Debian and redis on RHEL.

redis_package_name: "redis-server"
redis_requirepass: ""

Set a password for Redis authentication. You can create a strong password using echo "my_password_here" | sha256sum.

redis_disabled_commands: []

For added security, you can disable certain Redis commands. This is crucial if Redis is open to the public. For example:

redis_disabled_commands:
  - FLUSHDB
  - FLUSHALL
  - KEYS
  - PEXPIRE
  - DEL
  - CONFIG
  - SHUTDOWN
redis_extra_config: |-
  # Add extra lines of Redis configuration here.

Extra Redis configuration lines that can be added to the end of the redis.conf file.

Dependencies

None.

Example Playbook

- hosts: all
  roles:
    - role: geerlingguy.redis

License

MIT / BSD

Author Information

This role was developed in 2014 by Jeff Geerling, the author of Ansible for DevOps.

Installa
ansible-galaxy install geerlingguy.redis
Licenza
mit
Download
1.5M
Proprietario
Father, author, developer, maker. Sometimes called "an inflammatory enigma". #stl #drupal #ansible #k8s #raspberrypi #crohns