added tasks

This commit is contained in:
2023-10-31 12:33:59 +01:00
parent 095fac2f65
commit 72b607a117
10 changed files with 140 additions and 0 deletions

2
defaults/main.yml Normal file
View File

@@ -0,0 +1,2 @@
---
# defaults file for unifi_controller

View File

@@ -0,0 +1,39 @@
---
version: '3'
services:
unifi-db:
image: docker.io/mongo:4.4
container_name: unifi-db
environment:
PUID: 1000
GUID: 1000
volumes:
- {{ unifi_controller_app_dir }}/mongodb/data:/data/db
- {{ unifi_controller_app_dir }}/mongodb/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro
restart: always
unifi-network-application:
image: lscr.io/linuxserver/unifi-network-application:latest
container_name: unifi-network-application
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Berlin
- MONGO_USER=unifi
- MONGO_PASS=unifi
- MONGO_HOST=unifi-db
- MONGO_PORT=27017
- MONGO_DBNAME=unifi
volumes:
- {{ unifi_controller_app_dir }}/data:/config
ports:
- 8443:8443
- 3478:3478/udp
- 10001:10001/udp
- 8080:8080
- 1900:1900/udp #optional
- 8843:8843 #optional
- 8880:8880 #optional
- 6789:6789 #optional
- 5514:5514/udp #optional
restart: unless-stopped

2
files/init-mongo.js Normal file
View File

@@ -0,0 +1,2 @@
db.getSiblingDB("unifi").createUser({user: "unifi", pwd: "unifi", roles: [{role: "readWrite", db: "unifi"}]});
db.getSiblingDB("unifi_stat").createUser({user: "unifi", pwd: "unifi", roles: [{role: "readWrite", db: "unifi_stat"}]});

2
handlers/main.yml Normal file
View File

@@ -0,0 +1,2 @@
---
# handlers file for unifi_controller

View File

@@ -0,0 +1,2 @@
install_date: Mon Oct 23 14:05:36 2023
version: ''

47
meta/main.yml Normal file
View File

@@ -0,0 +1,47 @@
galaxy_info:
author: Tim Unkrig
description: docker install homelab
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)
min_ansible_version: "2.8"
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
platforms:
- name: Debian
versions:
- "bookworm"
- name: Ubuntu
versions:
- "jammy"
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

36
tasks/main.yml Normal file
View File

@@ -0,0 +1,36 @@
---
# tasks file for pi-hole
- name: Create unifi controller directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: '0755'
loop:
- "{{ unifi_controller_app_dir }}"
- "{{ unifi_controller_app_dir }}/data"
- "{{ unifi_controller_app_dir }}/mongodb"
- "{{ unifi_controller_app_dir }}/mongodb/data/"
- name: Copy init mongo script
ansible.builtin.copy:
src: "../files/init-mongo.js"
dest: "{{ unifi_controller_app_dir }}/mongodb"
owner: root
group: root
mode: '0755'
- name: Templating docker-compose.yml
ansible.builtin.template:
src: files/docker-compose.yaml.j2
dest: "{{ unifi_controller_app_dir }}/docker-compose.yaml"
owner: root
group: root
mode: '0660'
validate: docker-compose config --quiet --file %s
backup: true
- name: Start docker-compose
community.docker.docker_compose:
project_src: "{{ unifi_controller_app_dir }}"
state: present

2
tests/inventory Normal file
View File

@@ -0,0 +1,2 @@
localhost

5
tests/test.yml Normal file
View File

@@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- haup.gitea

3
vars/main.yml Normal file
View File

@@ -0,0 +1,3 @@
---
# vars file for unifi_controller
unifi_controller_app_dir: "/srv/unifi"