feat(redis): add ansible role
This commit is contained in:
parent
6cec7a4e8e
commit
58c5ea9321
38
roles/redis/defaults/main/container.yml
Normal file
38
roles/redis/defaults/main/container.yml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
redis_container_image_registry: docker.io
|
||||||
|
redis_container_image_namespace: ~
|
||||||
|
redis_container_image_name: redis
|
||||||
|
redis_container_image_tag: ~
|
||||||
|
redis_container_image_flavour: alpine
|
||||||
|
redis_container_image_source: pull
|
||||||
|
redis_container_image_force_source: >-2
|
||||||
|
{{ redis_container_image_tag | default(false, true) | bool }}
|
||||||
|
redis_container_image: >-2
|
||||||
|
{{
|
||||||
|
([
|
||||||
|
redis_container_image_registry | default([], true),
|
||||||
|
redis_container_image_namespace | default([], true),
|
||||||
|
redis_container_image_name,
|
||||||
|
] | flatten | join('/'))
|
||||||
|
+ ':' +
|
||||||
|
(redis_container_image_tag | default(
|
||||||
|
redis_version + (
|
||||||
|
(redis_container_image_flavour | default(false, true) | bool)
|
||||||
|
| ternary('-' + (redis_container_image_flavour | default('')), '')
|
||||||
|
),
|
||||||
|
true,
|
||||||
|
))
|
||||||
|
}}
|
||||||
|
|
||||||
|
redis_container_name: "redis{{ redis_instance_suffix }}"
|
||||||
|
redis_container_env: ~
|
||||||
|
redis_container_user: #TODO
|
||||||
|
redis_container_ports: ~
|
||||||
|
redis_container_labels: ~
|
||||||
|
redis_container_volumes: # TODO
|
||||||
|
redis_container_networks: ~
|
||||||
|
redis_container_etc_hosts: ~
|
||||||
|
redis_container_dns_servers: ~
|
||||||
|
redis_container_restart_policy: "unless-stopped"
|
||||||
|
redis_container_state: >-2
|
||||||
|
{{ (redis_state == 'present') | default('started', 'absent') }}
|
13
roles/redis/defaults/main/main.yml
Normal file
13
roles/redis/defaults/main/main.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
redis_version: "7.2.4"
|
||||||
|
redis_instance: ~
|
||||||
|
redis_instance_suffix: >-2
|
||||||
|
{{ (redis_instance | default(false, true) | bool)
|
||||||
|
| ternary('-' + (redis_instance | default('')), '') }}
|
||||||
|
redis_user: >-2
|
||||||
|
redis{{ redis_instance_suffix }}
|
||||||
|
|
||||||
|
redis_config_path: "/etc/redis"
|
||||||
|
redis_config_file: >-2
|
||||||
|
{{ redis_config_path }}/redis{{ redis_instance_suffix }}.conf
|
||||||
|
redis_data_path: "/var/lib/redis{{ redis_instance_suffix }}"
|
0
roles/redis/handlers/main.yml
Normal file
0
roles/redis/handlers/main.yml
Normal file
0
roles/redis/meta/main.yml
Normal file
0
roles/redis/meta/main.yml
Normal file
7
roles/redis/tasks/main.yml
Normal file
7
roles/redis/tasks/main.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
- name: Ensure state is valid
|
||||||
|
ansible.builtin.fail:
|
||||||
|
msg: >-2
|
||||||
|
Unsupported state '{{ redis_state }}'.
|
||||||
|
Supported states are {{ redis_states | join(', ') }}
|
||||||
|
when: redis_state not in redis_states
|
4
roles/redis/vars/main.yml
Normal file
4
roles/redis/vars/main.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
redis_states:
|
||||||
|
- present
|
||||||
|
- absent
|
Loading…
Reference in New Issue
Block a user