2023-08-23 20:48:34 -04:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: Install Docker packages
|
|
|
|
community.general.pacman:
|
|
|
|
name:
|
|
|
|
- docker
|
|
|
|
- docker-compose
|
|
|
|
|
2023-08-27 20:33:18 -04:00
|
|
|
- name: Create docker user
|
|
|
|
user:
|
|
|
|
name: docker
|
|
|
|
group: docker
|
|
|
|
|
2023-09-02 18:20:46 -04:00
|
|
|
- name: Create Gitea user
|
|
|
|
user:
|
|
|
|
name: gitea
|
|
|
|
register: user_gitea
|
2024-06-19 14:05:35 -04:00
|
|
|
when: '"gitea" in group_names'
|
2023-09-02 18:20:46 -04:00
|
|
|
|
2023-09-03 19:38:29 -04:00
|
|
|
- name: Create Syncthing group
|
|
|
|
group:
|
|
|
|
name: vault
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Create Syncthing user
|
|
|
|
user:
|
|
|
|
name: syncthing
|
|
|
|
group: vault
|
|
|
|
register: user_syncthing
|
2024-06-19 14:05:35 -04:00
|
|
|
when: '"syncthing" in group_names'
|
2023-09-03 19:38:29 -04:00
|
|
|
|
2023-09-04 20:09:48 -04:00
|
|
|
- name: Create Syncthing vault directories
|
2023-09-04 15:28:03 -04:00
|
|
|
file:
|
2023-09-04 20:09:48 -04:00
|
|
|
path: "{{ item }}"
|
2023-09-04 15:28:03 -04:00
|
|
|
state: directory
|
|
|
|
owner: syncthing
|
|
|
|
group: vault
|
|
|
|
mode: "u=rwX,g=rwX,o="
|
2023-09-04 20:09:48 -04:00
|
|
|
with_items:
|
|
|
|
- "{{ vault_path }}"
|
|
|
|
- "{{ archive_path }}"
|
2023-09-04 15:28:03 -04:00
|
|
|
|
|
|
|
- name: Create Syncthing config directory
|
|
|
|
file:
|
|
|
|
path: "{{ syncthing_conf_dir }}"
|
|
|
|
state: directory
|
|
|
|
owner: syncthing
|
|
|
|
group: vault
|
|
|
|
mode: "u=rwX,g=,o="
|
|
|
|
|
|
|
|
- name: Add unpriviledged user to file management group
|
|
|
|
user:
|
|
|
|
name: "{{ username }}"
|
|
|
|
append: yes
|
|
|
|
groups: vault
|
2023-12-09 21:36:36 -05:00
|
|
|
|
|
|
|
- name: Create Paperless group
|
|
|
|
group:
|
|
|
|
name: paperless
|
|
|
|
state: present
|
|
|
|
register: group_paperless
|
|
|
|
|
|
|
|
- name: Create Paperless user
|
|
|
|
user:
|
|
|
|
name: paperless
|
|
|
|
group: paperless
|
|
|
|
register: user_paperless
|
|
|
|
|
|
|
|
- name: Create Paperless directories
|
|
|
|
file:
|
|
|
|
path: "{{ dataroot }}/paperless/{{ item }}"
|
|
|
|
state: directory
|
|
|
|
owner: paperless
|
|
|
|
group: paperless
|
|
|
|
mode: "u=rwX,g=,o="
|
|
|
|
with_items:
|
|
|
|
- data
|
|
|
|
- media
|
|
|
|
|
|
|
|
- name: Create Paperless consume directory
|
|
|
|
file:
|
|
|
|
path: "{{ dataroot }}/paperless/consume"
|
|
|
|
state: directory
|
|
|
|
owner: paperless
|
2024-03-03 09:58:35 -05:00
|
|
|
group: vault
|
2023-12-09 21:36:36 -05:00
|
|
|
mode: "u=rwX,g=rwX,o="
|
|
|
|
|
|
|
|
- name: Create Paperless .env file
|
|
|
|
template:
|
|
|
|
src: "paperless.env.j2"
|
|
|
|
dest: "{{ docker_compose_dir }}/paperless.env"
|
|
|
|
lstrip_blocks: true
|
2023-09-04 15:28:03 -04:00
|
|
|
|
2023-09-26 18:43:51 -04:00
|
|
|
- name: Create Navidrome user
|
|
|
|
user:
|
|
|
|
name: navidrome
|
|
|
|
register: user_navidrome
|
2024-06-19 14:05:35 -04:00
|
|
|
when: '"navidrome" in group_names'
|
2023-09-26 18:43:51 -04:00
|
|
|
|
|
|
|
- name: Create Navidrome directory
|
|
|
|
file:
|
|
|
|
path: "{{ dataroot }}/navidrome"
|
|
|
|
state: directory
|
|
|
|
owner: navidrome
|
|
|
|
group: navidrome
|
|
|
|
mode: "u=rwX,g=rwX,o="
|
|
|
|
|
|
|
|
- name: Create music directory
|
|
|
|
file:
|
|
|
|
path: "{{ music_path }}"
|
|
|
|
state: directory
|
|
|
|
owner: navidrome
|
|
|
|
group: vault
|
|
|
|
mode: "u=rwX,g=rwX,o="
|
|
|
|
|
2024-10-12 10:37:49 -04:00
|
|
|
- name: Set ACL to allow navidrome to read synced music
|
|
|
|
ansible.posix.acl:
|
|
|
|
default: true
|
|
|
|
entity: navidrome
|
|
|
|
etype: user
|
|
|
|
permissions: rx
|
|
|
|
recursive: true
|
|
|
|
state: present
|
|
|
|
path: "{{ music_path }}"
|
|
|
|
|
2023-08-23 20:48:34 -04:00
|
|
|
- name: Create docker-compose directory
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: "{{ docker_compose_dir }}"
|
|
|
|
owner: "{{ admin_username }}"
|
|
|
|
group: "{{ admin_username }}"
|
|
|
|
state: directory
|
|
|
|
|
2023-09-07 21:47:16 -04:00
|
|
|
- name: Create Synapse user
|
|
|
|
user:
|
|
|
|
name: synapse
|
|
|
|
register: user_synapse
|
2024-06-19 14:05:35 -04:00
|
|
|
when: '"synapse" in group_names'
|
2023-09-07 21:47:16 -04:00
|
|
|
|
2023-08-23 20:48:34 -04:00
|
|
|
- name: Generate docker-compose.yml
|
|
|
|
template:
|
2023-08-27 17:39:08 -04:00
|
|
|
src: "docker-compose.yml.j2"
|
2023-08-23 20:48:34 -04:00
|
|
|
dest: "{{ docker_compose_dir }}/docker-compose.yml"
|
2023-09-03 22:05:22 -04:00
|
|
|
lstrip_blocks: true
|
2023-08-27 21:59:01 -04:00
|
|
|
register: generateComp
|
2023-08-23 20:48:34 -04:00
|
|
|
|
2023-08-27 17:39:08 -04:00
|
|
|
- name: Create systemd unit file
|
|
|
|
template:
|
|
|
|
src: "docker-compose.service.j2"
|
|
|
|
dest: "/etc/systemd/system/docker-compose.service"
|
|
|
|
|
2023-08-27 21:59:01 -04:00
|
|
|
- name: Compose up (update images if necessary)
|
2023-08-27 17:39:08 -04:00
|
|
|
systemd:
|
|
|
|
name: docker-compose
|
2023-08-27 21:59:01 -04:00
|
|
|
state: reloaded
|
2023-08-27 17:39:08 -04:00
|
|
|
enabled: true
|
2023-08-27 21:59:01 -04:00
|
|
|
register: compUp
|