Git Product home page Git Product logo

ansible-role-redis's Introduction

Redis Ansible Role

⚠️ This project is archived! ⚠️

This role has been migrated to our hifis.toolkit collection:

CI Status Ansible Role: hifis.redis Ansible Role Downloads Apache-2.0 Licensed Latest release DOI

A role to set up Redis instances to be used as caching servers in a high availability and scalability context.

Currently supported platforms are:

  • Ubuntu 20.04 LTS
  • Ubuntu 22.04 LTS

Requirements

None.

Role Variables

The Redis version to install:

redis_version: '7.2.1'

Specifies whether the current node is master, or a replica instance:

redis_instance_type: 'master'

The IP address to bind Redis to:

redis_instance_ip: "127.0.0.1"

The Redis Master instance IP address:

redis_master_instance_ip: "{{ redis_instance_ip if redis_instance_type == 'master' else None }}"

The name of the Redis cluster monitored by Sentinel:

redis_cluster_name: 'redis-cluster'

Password used to authenticate in the Redis cluster:

redis_password: 'changeme'

List of dependent packages required by Redis Server:

redis_dependencies:
  - 'build-essential'

URL from which Redis Server can be downloaded:

redis_download_url: "https://download.redis.io/releases/redis-{{ redis_version }}.tar.gz"

File path to the Redis Server binary:

redis_bin: '/usr/local/bin/redis-server'

File path to the directory in which Redis Server is build:

redis_build_dir: '/usr/local/src/redis-{{ redis_version }}'

Directory into which Redis service files are copied:

redis_systemd_dir: '/etc/systemd/system'

Redis Server service file path:

redis_server_service_file: '{{ redis_systemd_dir }}/redis-server.service'

Redis Sentinel service file path:

redis_sentinel_service_file: '{{ redis_systemd_dir }}/redis-sentinel.service'

Password for Redis Sentinel. This is unset by default.

redis_sentinel_password: 'changeme'

Redis configuration directory path:

redis_configuration_dir: '/etc/redis'

Path to Redis Server configuration file:

redis_server_configuration_file: '{{ redis_configuration_dir }}/redis.conf'

Path to Redis Sentinel configuration file:

redis_sentinel_configuration_file: '{{ redis_configuration_dir }}/sentinel.conf'

Redis library directory:

redis_lib_dir: '/var/lib/redis'

Redis logging directory:

redis_log_dir: '/var/log/redis'

Path to Redis Server log file:

redis_server_log_file_path: "{{ redis_log_dir }}/redis-server.log"

Path to Redis Sentinel log file:

redis_sentinel_log_file_path: "{{ redis_log_dir }}/redis-sentinel.log"

Redis log level, can be one of: debug, verbose, notice, warning:

redis_log_level: 'notice'

Sentinel log level, can be one of: debug, verbose, notice, warning:

sentinel_log_level: 'notice'

Enable/disable Redis Server protected mode:

redis_protected_mode: 'yes'

Enable/disable Redis Sentinel protected mode:

sentinel_protected_mode: 'yes'

Redis username:

redis_user: 'redis'

Redis group name:

redis_group: 'redis'

Redis Server service name:

redis_server_service_name: 'redis-server'

Redis Sentinel service name:

redis_sentinel_service_name: 'redis-sentinel'

Dependencies

None.

Example Playbook

- hosts: servers
  roles:
    - role: hifis.redis

License

Apache-2.0

Author Information

HIFIS Software Team

ansible-role-redis's People

Contributors

christianhueserhzdr avatar dependabot[bot] avatar normo avatar renovate-bot avatar tobiashuste avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

ansible-role-redis's Issues

Molecule folder not linted by molecule

When providing . as the folder path of the lintables to ansible-lint it does not lint the folder molecule/default containing converge.yml, prepare.yml, verify.yml, hence folder molecule/ need to be added to the ansible-lint call in the molecule lint commands.

Add support for initial dry-runs to role

The role will fail in initial dry-runs if package build-essential is not installed on instance.

Since something like ignore_errors: "{{ is_initial_dryrun }}" is not recommended and even discouraged by ansible-lint:

ignore-errors: Use failed_when and specify error conditions instead of using ignore_errors. (warning)

It can be solved by registering the task output and checking for "failed == true" like this:

  register: output
  failed_when: "not is_initial_dryrun and output.failed == true"

Source: https://ansible-lint.readthedocs.io/rules/ignore-errors/

/cc Tobias @tobiashuste and Norman @Normo, do you agree?

Conflicting configuration generated by CONFIG REWRITE

It must be ensured that there are no conflicting configurations in the auto-generated configuration section when the role changes the configuration.

E.g. if you set a new password for sentinel the result looks like this (the nopass directive for the default user overrides the requirepass):


requirepass "MY-NEW-SENTINEL-PASSWORD"

...

# Generated by CONFIG REWRITE
...
user default on nopass sanitize-payload ~* &* +@all 

The nopass directive overrides the requirepass.

Adapt Redis config template due to changes after restart of Redis service

Mostly, quotations have been changed in redis.conf:

-loglevel notice
-dir "/var/lib/redis"
+loglevel "notice"
+dir /var/lib/redis/

-rdbcompression yes
+rdbcompression "yes"
 
-dbfilename "dump.rdb"
+dbfilename dump.rdb
 
-appendonly no
-appendfsync everysec
+appendonly "no"
+appendfsync "everysec"
 
-protected-mode yes
+protected-mode "yes"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.