ansible-nas/roles/timemachine/tasks/main.yml

51 lines
1.5 KiB
YAML
Raw Normal View History

2018-12-28 01:00:51 +00:00
---
2023-03-10 21:00:37 +00:00
- name: Start Time Machine
block:
- name: Time Machine Directories
ansible.builtin.file:
path: "{{ timemachine_data_directory }}"
state: directory
2018-12-28 01:00:51 +00:00
2023-03-10 21:00:37 +00:00
- name: Time Machine Docker Container
community.docker.docker_container:
container_default_behavior: no_defaults
name: "{{ timemachine_container_name }}"
image: "{{ timemachine_image_name }}:{{ timemachine_image_version }}"
pull: true
ports:
- "{{ timemachine_port }}:445"
env:
TMSIZE: "{{ timemachine_volume_size_limit }}"
PASS: "{{ timemachine_password }}"
SHARENAME: "{{ timemachine_share_name }}"
volumes:
- "{{ timemachine_data_directory }}/data:/backups"
ulimits:
- "nofile:1048576:1048576"
network_mode: bridge
restart_policy: unless-stopped
memory: "{{ timemachine_memory }}"
2023-03-10 21:00:37 +00:00
- name: Install avahi
ansible.builtin.apt:
name: "avahi-daemon"
state: present
2023-03-10 21:36:46 +00:00
update_cache: yes
2023-03-10 21:00:37 +00:00
register: result
until: result is succeeded
2023-03-10 21:00:37 +00:00
- name: Setup timemachine service for avahi
ansible.builtin.template:
src: timemachine.service
dest: "/etc/avahi/services/timemachine.service"
2023-03-10 21:36:46 +00:00
notify: reload avahi configuration
2023-03-10 21:00:37 +00:00
when: timemachine_enabled is true
- name: Stop Time Machine
block:
- name: Stop Time Machine
community.docker.docker_container:
name: "{{ timemachine_container_name }}"
state: absent
when: timemachine_enabled is false