xoxys.redis/tasks/main.yml

57 lines
1.6 KiB
YAML
Raw Permalink Normal View History

2021-06-01 19:32:28 +00:00
---
- block:
- name: Create network specs
template:
src: etc/containers/systemd/redis.network.j2
dest: "/etc/containers/systemd/redis.network"
owner: root
group: root
mode: "0640"
when: redis_network | splitext | last == ".network"
notify: __redis_restart
- name: Create container volumes
containers.podman.podman_volume:
name: "{{ item.name }}"
options: "{{ item.options | default(omit) }}"
state: "{{ item.state | default('present') }}"
loop: "{{ redis_volumes }}"
loop_control:
label: "{{ item.name }}"
when: item.type | default("volume") | lower == "volume"
register: __redis_volumes_raw
- name: Register container volumes map
set_fact:
__redis_volumes_map: "{{ __redis_volumes_raw.results | json_query('[].volume') | items2dict(key_name='Name', value_name='Mountpoint') }}"
2023-08-05 21:49:35 +00:00
- name: Deploy redis env files
template:
2023-08-05 21:49:35 +00:00
src: "etc/containers/systemd/{{ item }}.j2"
dest: "/etc/containers/systemd/{{ item }}"
owner: root
group: root
mode: "0640"
2023-08-05 21:49:35 +00:00
loop:
- redis.env
- redis.sys.env
notify: __redis_restart
- name: Create container specs
template:
src: etc/containers/systemd/redis.container.j2
dest: "/etc/containers/systemd/redis.container"
owner: root
group: root
mode: "0640"
notify: __redis_restart
- name: Ensure service state
systemd:
name: "redis.service"
state: started
daemon_reload: True
enabled: True
become: True
become_user: root