You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.1 KiB
YAML

---
- name: Create required directories
file:
state: directory
path: "{{ item }}"
owner: "{{ system_user }}"
group: "{{ system_user }}"
mode: u=rwx,g=rx,o=
loop:
- "{{ redis_directory }}"
- "{{ data_directory }}"
- "{{ run_directory }}"
- name: Configure instance
template:
src: redis.conf
dest: "{{ configuration_file }}"
owner: root
group: "{{ system_user }}"
mode: u=rw,g=r,o=
register: configuration_file_task
- name: Configure service for instance
template:
src: redis.service
dest: "{{ service_file }}"
owner: root
group: root
mode: u=rw,g=r,o=
notify:
- reload systemd
register: service_file_task
- meta: flush_handlers
# TODO transfer to handler when handler reloading is possible
- name: Restart service if changes were applied
systemd:
name: "{{ service_name }}"
state: restarted
when: configuration_file_task.changed or service_file_task.changed
- name: Enable and start instance service
systemd:
name: "{{ service_name }}"
state: started
enabled: yes