mirror of
https://github.com/famedly/ansible-collection-base
synced 2024-11-10 06:24:17 +00:00
fix(redis): resolve lints
This commit is contained in:
parent
d90937606d
commit
1da8ffafd4
4 changed files with 39 additions and 49 deletions
|
@ -1,30 +1,27 @@
|
|||
---
|
||||
|
||||
redis_version: "6.2.6"
|
||||
redis_version: 6.2.6
|
||||
redis_user: "{{ redis_prefix }}redis"
|
||||
redis_basepath: "/opt/redis"
|
||||
redis_basepath: /opt/redis
|
||||
redis_data_dir: "{{ redis_basepath }}/{{ redis_prefix }}data"
|
||||
redis_config_dir: "{{ redis_basepath }}/{{redis_prefix }}config"
|
||||
redis_config_dir: "{{ redis_basepath }}/{{ redis_prefix }}config"
|
||||
redis_config_file: "{{ redis_config_dir }}/redis.conf"
|
||||
redis_secret: ~
|
||||
|
||||
redis_config_bind_ip: "0.0.0.0"
|
||||
redis_config_unix_socket_path: ~
|
||||
redis_secret:
|
||||
redis_config_bind_ip: 0.0.0.0
|
||||
redis_config_unix_socket_path:
|
||||
redis_config_unix_socket_perm: 775
|
||||
redis_config_max_memory_mb: ~
|
||||
redis_config_max_memory_policy: ~ # allkeys-lru
|
||||
redis_config_max_memory_mb:
|
||||
redis_config_max_memory_policy: # allkeys-lru
|
||||
|
||||
# Overwrite per-instance to be able to run many instances on the same host
|
||||
# prefix should be sth like 'matrix_', modifies mapped directories, container name and uer
|
||||
redis_prefix: ""
|
||||
|
||||
redis_docker_labels: {}
|
||||
redis_docker_configpath: "/usr/local/etc/redis/redis.conf"
|
||||
redis_docker_image: "docker.io/library/redis:{{ redis_docker_tag }}"
|
||||
redis_docker_configpath: /usr/local/etc/redis/redis.conf
|
||||
redis_docker_image: docker.io/library/redis:{{ redis_docker_tag }}
|
||||
redis_docker_tag: "{{ redis_version }}-alpine"
|
||||
redis_docker_container_name: "{{ redis_prefix }}redis"
|
||||
redis_docker_ports: [ "6379:6379" ]
|
||||
redis_docker_networks: ~
|
||||
redis_docker_ports: [6379:6379]
|
||||
redis_docker_networks:
|
||||
redis_docker_purge_networks: false
|
||||
redis_docker_volumes:
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
|
||||
- name: restart-redis
|
||||
- name: Restart redis
|
||||
docker_container:
|
||||
name: "{{ redis_docker_container_name }}"
|
||||
state: started
|
||||
restart: yes
|
||||
restart: true
|
||||
listen: restart-redis
|
||||
|
|
|
@ -1,57 +1,53 @@
|
|||
---
|
||||
|
||||
- name: Create redis user
|
||||
user:
|
||||
ansible.builtin.user:
|
||||
name: "{{ redis_user }}"
|
||||
create_home: no
|
||||
create_home: false
|
||||
state: present
|
||||
register: redis_user_res
|
||||
tags: ['prepare', 'prepare-redis',
|
||||
'deploy', 'deploy-redis']
|
||||
|
||||
tags: [prepare, prepare-redis, deploy, deploy-redis]
|
||||
- name: Create redis directory
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "{{ redis_basepath }}"
|
||||
state: directory
|
||||
owner: "{{ redis_user }}"
|
||||
group: "{{ redis_user }}"
|
||||
tags: ['prepare', 'prepare-redis']
|
||||
|
||||
mode: "0700"
|
||||
tags: [prepare, prepare-redis]
|
||||
- name: Create redis directory for data persistance
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "{{ redis_data_dir }}"
|
||||
state: directory
|
||||
owner: "{{ redis_user }}"
|
||||
group: "{{ redis_user }}"
|
||||
tags: ['prepare', 'prepare-redis']
|
||||
|
||||
mode: "0700"
|
||||
tags: [prepare, prepare-redis]
|
||||
- name: Create redis config directory
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "{{ redis_config_dir }}"
|
||||
state: directory
|
||||
owner: "{{ redis_user }}"
|
||||
group: "{{ redis_user }}"
|
||||
tags: ['prepare', 'prepare-redis']
|
||||
|
||||
mode: "0700"
|
||||
tags: [prepare, prepare-redis]
|
||||
- name: Template redis config file
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: redis.conf.j2
|
||||
dest: "{{ redis_config_file }}"
|
||||
owner: "{{ redis_user }}"
|
||||
group: "{{ redis_user }}"
|
||||
mode: "0700"
|
||||
notify: restart-redis
|
||||
tags: ['deploy', 'deploy-redis']
|
||||
|
||||
tags: [deploy, deploy-redis]
|
||||
- name: Ensure redis container image is present
|
||||
docker_image:
|
||||
community.docker.docker_image:
|
||||
name: "{{ redis_docker_image }}"
|
||||
force_source: "{{ redis_docker_image_force_pull|default(False) }}"
|
||||
force_source: "{{ redis_docker_image_force_pull | default(False) }}"
|
||||
source: pull
|
||||
state: present
|
||||
tags: ['prepare', 'prepare-redis']
|
||||
|
||||
tags: [prepare, prepare-redis]
|
||||
- name: Setup redis docker container
|
||||
docker_container:
|
||||
community.docker.docker_container:
|
||||
image: "{{ redis_docker_image }}"
|
||||
name: "{{ redis_docker_container_name }}"
|
||||
restart_policy: unless-stopped
|
||||
|
@ -61,12 +57,11 @@
|
|||
labels: "{{ redis_docker_labels_complete }}"
|
||||
networks: "{{ redis_docker_networks | default(omit, True) }}"
|
||||
purge_networks: "{{ redis_docker_purge_networks }}"
|
||||
entrypoint: "redis-server"
|
||||
command: [ "{{ redis_docker_configpath }}" ]
|
||||
entrypoint: redis-server
|
||||
command: ["{{ redis_docker_configpath }}"]
|
||||
healthcheck:
|
||||
test: >-
|
||||
redis-cli -a {{ redis_secret }} PING || exit 1
|
||||
tags: ['deploy', 'deploy-redis']
|
||||
|
||||
tags: [deploy, deploy-redis]
|
||||
- name: Ensure redis is restarted if config changed
|
||||
meta: flush_handlers
|
||||
ansible.builtin.meta: flush_handlers
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
---
|
||||
|
||||
redis_docker_volumes_base:
|
||||
- "{{ redis_data_dir }}:/data"
|
||||
- "{{ redis_config_file }}:{{ redis_docker_configpath }}"
|
||||
redis_docker_volumes: "{{ redis_docker_volumes_base + redis_docker_extra_volumes|default([]) }}"
|
||||
redis_docker_volumes: "{{ redis_docker_volumes_base + redis_docker_extra_volumes | default([]) }}"
|
||||
|
||||
redis_docker_labels_base:
|
||||
version: "{{ redis_version }}"
|
||||
redis_docker_labels_complete: "{{ redis_docker_labels_base | combine(redis_docker_labels) }}"
|
||||
|
||||
|
|
Loading…
Reference in a new issue