Initial import

This commit is contained in:
Frank Agerholm 2024-03-07 22:38:24 +01:00
commit c28551bb63
No known key found for this signature in database
22 changed files with 357 additions and 0 deletions

View file

@ -0,0 +1,2 @@
---
redis_clients_group: all

21
roles/redis/meta/main.yml Normal file
View file

@ -0,0 +1,21 @@
galaxy_info:
author: Frank Agerholm
description: Redis installation and Configuration
company: serverWG.de
issue_tracker_url: "https://git.serverwg.de/fager/ansible-demo-retwis/issues/new"
license: "GPL"
min_ansible_version: "2.11"
platforms:
- name: EL
versions:
- "7"
- "8"
- "9"
galaxy_tags: []
dependencies: []

View file

@ -0,0 +1,37 @@
---
- name: Install Redis Database
ansible.builtin.dnf:
name: redis
state: present
- name: Configure Redis to listen on all IPs
ansible.builtin.lineinfile:
path: /etc/redis/redis.conf
regexp: '^bind '
line: 'bind 0.0.0.0'
- name: Enable and start the redis service
ansible.builtin.service:
name: redis
state: started
enabled: true
- name: Gather facts from client systems
ansible.builtin.setup:
delegate_to: "{{ item }}"
delegate_facts: true
loop: "{{ groups[redis_clients_group] }}"
- name: Ensure Firewall is enabled
ansible.builtin.systemd:
name: firewalld.service
state: started
enabled: true
- name: Open the Firewall
ansible.posix.firewalld:
rich_rule: 'rule family="ipv4" source address="{{ item }}/32" port protocol="tcp" port="6379" accept'
permanent: true
state: enabled
immediate: true
loop: "{{ groups[redis_clients_group] | map('extract', hostvars, ['ansible_facts', 'default_ipv4', 'address']) | list }}"