57 lines
1.6 KiB
YAML
57 lines
1.6 KiB
YAML
---
|
|
- 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') }}"
|
|
|
|
- name: Deploy redis env files
|
|
template:
|
|
src: "etc/containers/systemd/{{ item }}.j2"
|
|
dest: "/etc/containers/systemd/{{ item }}"
|
|
owner: root
|
|
group: root
|
|
mode: "0640"
|
|
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
|