Getting started
Default configuration
At the initial deployment, the role will disable the default Redis instance configuration defined by the distribution packages. Next, a new, systemd-based instance will be created with the configuration like TCP ports and UNIX socket the same as the default Redis Server setup. This should allow easy creation of additional Redis instances when necessary.
Example inventory
To enable Redis Server configuration on a host, it needs to be added to a specific Ansible inventory group:
[debops_service_redis_server]
hostname
By default Redis listens only for local connections on the loopback
network
interface. If you want to set up a cluster of Redis instances on different
hosts that talk to each other, you should configure the default instance to
bind to all network interfaces, as well as open the TCP ports in the firewall:
# Listen to TCP connections on all interfaces
redis_server__bind: [ '0.0.0.0', '::' ]
# Allow connections to Redis from specific subnets
redis_server__allow: [ '192.0.2.0/24', '2001:db8::/32' ]
Example playbook
If you are using this role without DebOps, here's an example Ansible playbook
that uses the debops.redis_server
role:
---
- name: Manage Redis server
collections: [ 'debops.debops', 'debops.roles01',
'debops.roles02', 'debops.roles03' ]
hosts: [ 'debops_service_redis_server' ]
become: True
environment: '{{ inventory__environment | d({})
| combine(inventory__group_environment | d({}))
| combine(inventory__host_environment | d({})) }}'
pre_tasks:
- name: Prepare sysfs environment
ansible.builtin.import_role:
name: 'sysfs'
tasks_from: 'main_env'
tags: [ 'role::sysfs', 'role::secret' ]
- name: Prepare redis_server environment
ansible.builtin.import_role:
name: 'redis_server'
tasks_from: 'main_env'
tags: [ 'role::redis_server', 'role::ferm' ]
roles:
- role: secret
tags: [ 'role::secret', 'role::sysfs' ]
secret__directories:
- '{{ sysfs__secret__directories | d([]) }}'
- role: apt_preferences
tags: [ 'role::apt_preferences', 'skip::apt_preferences' ]
apt_preferences__dependent_list:
- '{{ redis_server__apt_preferences__dependent_list }}'
- role: etc_services
tags: [ 'role::etc_services', 'skip::etc_services' ]
etc_services__dependent_list:
- '{{ redis_server__etc_services__dependent_list }}'
- role: ferm
tags: [ 'role::ferm', 'skip::ferm' ]
ferm__dependent_rules:
- '{{ redis_server__ferm__dependent_rules }}'
- role: sysctl
tags: [ 'role::sysctl', 'skip::sysctl' ]
sysctl__dependent_parameters:
- '{{ redis_server__sysctl__dependent_parameters }}'
- role: sysfs
tags: [ 'role::sysfs', 'skip::sysfs' ]
sysfs__dependent_attributes:
- '{{ redis_server__sysfs__dependent_attributes }}'
- role: python
tags: [ 'role::python', 'skip::python', 'role::redis_server' ]
python__dependent_packages3:
- '{{ redis_server__python__dependent_packages3 }}'
python__dependent_packages2:
- '{{ redis_server__python__dependent_packages2 }}'
- role: redis_server
tags: [ 'role::redis_server', 'skip::redis_server' ]
Other resources
List of other useful resources related to the debops.redis_server
Ansible
role: