49 lines
1.4 KiB
YAML
49 lines
1.4 KiB
YAML
---
|
|
- name: Load distro-specific variables
|
|
ansible.builtin.include_vars: '{{ item }}'
|
|
tags: always
|
|
with_first_found:
|
|
- files:
|
|
- "{{ ansible_distribution }}.yaml"
|
|
skip: true
|
|
|
|
- name: Ensure unifi-network-application is installed on hosts
|
|
block:
|
|
- name: Ensure presense of folders for processes on the server
|
|
tags: packages,docker,unifi
|
|
ansible.builtin.file:
|
|
path: "/opt/unifi/{{ item }}"
|
|
state: directory
|
|
owner: 1000
|
|
group: 1000
|
|
recurse: true
|
|
loop:
|
|
- unifi/data
|
|
- mongo/data
|
|
- name: Ensure compose files are available on the server
|
|
tags: packages,docker,unifi
|
|
ansible.builtin.copy:
|
|
src: docker-compose.yaml
|
|
dest: "/opt/unifi/docker-compose.yaml"
|
|
owner: 1000
|
|
group: 1000
|
|
mode: u=rw,g=r,o=r
|
|
- name: Ensure mongo initialization script is available
|
|
tags: packages,docker,unifi
|
|
ansible.builtin.copy:
|
|
src: init-mongo.sh
|
|
dest: /opt/unifi/init-mongo.sh
|
|
owner: 1000
|
|
group: 1000
|
|
mode: u=rw,g=r,o=r
|
|
- name: Ensure docker containers are pulled and running
|
|
tags: docker,unifi
|
|
community.docker.docker_compose_v2:
|
|
project_src: "/opt/unifi"
|
|
pull: always
|
|
|
|
rescue:
|
|
- name: Set that this task failed
|
|
ansible.builtin.set_fact:
|
|
task_failed: true
|
|
# code: language=ansible
|