This commit is contained in:
Annika Merris 2025-05-02 21:51:45 +00:00
parent 5816898404
commit 6eef878c4d
11 changed files with 276 additions and 78 deletions

View file

@ -0,0 +1,49 @@
---
- 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