2021-06-01 19:32:28 +00:00
|
|
|
---
|
2023-08-05 15:53:22 +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
|
2023-08-05 15:53:22 +00:00
|
|
|
template:
|
2023-08-05 21:49:35 +00:00
|
|
|
src: "etc/containers/systemd/{{ item }}.j2"
|
|
|
|
dest: "/etc/containers/systemd/{{ item }}"
|
2023-08-05 15:53:22 +00:00
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: "0640"
|
2023-08-05 21:49:35 +00:00
|
|
|
loop:
|
|
|
|
- redis.env
|
|
|
|
- redis.sys.env
|
2023-08-05 15:53:22 +00:00
|
|
|
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
|