role separation

This commit is contained in:
Warezjoe
2024-08-08 09:39:04 +02:00
parent fca0d8655b
commit 8bd24c852f
192 changed files with 113 additions and 3884 deletions

View File

@@ -1,29 +0,0 @@
---
language: python
python: "2.7"
# Use the new container infrastructure
sudo: false
# Install ansible
addons:
apt:
packages:
- python-pip
install:
# Install ansible
- pip install ansible
# Check ansible version
- ansible --version
# Create ansible.cfg with correct roles_path
- printf '[defaults]\nroles_path=../' >ansible.cfg
script:
# Basic role syntax check
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/

View File

@@ -1,38 +0,0 @@
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View File

@@ -1,3 +0,0 @@
---
# defaults file for docker_spin_up
docker_homepath: "/{{ zfs_pool_name }}/{{ docker_name }}"

View File

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

View File

@@ -1,52 +0,0 @@
galaxy_info:
author: your name
description: your role description
company: your company (optional)
# 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.1
# 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: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
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.

View File

@@ -1,9 +0,0 @@
---
- name: "{{ docker_name }}"
community.docker.docker_container:
name: "{{ docker_name }}"
image: ghcr.io/gethomepage/homepage:latest
ports:
- 3000:3000
volumes:
- "{{ docker_homepath }}/config:/app/config" # Make sure your local config directory exists

View File

@@ -1,4 +0,0 @@
---
- name: email
community.docker.docker_container:

View File

@@ -1,24 +0,0 @@
---
- name: gitea
community.docker.docker_container:
image: gitea/gitea:1.19.3
name: gitea
env:
USER_UID: "1000"
USER_GID: "1000"
GITEA__database__DB_TYPE: "mysql"
GITEA__database__HOST: "{{ mysql_host}}:3306"
GITEA__database__NAME: "{{ GITEA__database__NAME }}"
GITEA__database__USER: "{{ GITEA__database__USER }}"
GITEA__database__PASSWD: "{{ GITEA__database__PASSWD }}"
ROOT_URL: "http://pi-vpn:8082/"
restart_policy: always
networks:
- name: http
volumes:
- "{{ docker_homepath }}/gitea:/data"
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
# - "8082:3000"
- "222:22"

View File

@@ -1,29 +0,0 @@
- name: Dir-jellyfin-config
ansible.builtin.file:
path: "{{ docker_homepath }}/config"
owner: "{{ user }}"
group: "{{ primary_group }}"
state: directory
mode: '0711'
- name: Dir-jellyfin-cache
ansible.builtin.file:
path: "{{ docker_homepath }}/cache"
owner: "{{ user }}"
group: "{{ primary_group }}"
state: directory
mode: '0711'
- name: jellyfin
community.docker.docker_container:
name: jellyfin
image: jellyfin/jellyfin:2024042215
user: "{{ uid }}:{{ gid }}"
volumes:
- "/bigpool/tata/Music:/Music:ro"
- "{{ docker_homepath }}/config:/config"
- "{{ docker_homepath }}/cache:/cache"
restart_policy: unless-stopped
networks:
- name: http

View File

@@ -1,17 +0,0 @@
---
# tasks file for docker_spin_up
#- name: Copy composer
# template:
# src: "../templates/{{ docker_compose_file }}"
# dest: "/{{ docker_homepath }}/docker-compose.yml"
# owner: root
# group: root
# mode: '0644'
- name: Create a network
community.docker.docker_network:
name: http
- name: Spin up {{ docker_compose_file }}
ansible.builtin.include_tasks:
"{{ docker_compose_file }}"

View File

@@ -1,82 +0,0 @@
---
- name: Dir-loki
ansible.builtin.file:
path: "{{ docker_homepath }}/loki-data"
owner: "{{ user }}"
group: "{{ primary_group }}"
state: directory
mode: '0711'
- name: Dir-grafana
ansible.builtin.file:
path: "{{ docker_homepath }}/grafana-data"
owner: "{{ user }}"
group: "{{ primary_group }}"
state: directory
mode: '0711'
- name: Dir-promtail
ansible.builtin.file:
path: "{{ docker_homepath }}/promtail-data"
owner: "{{ user }}"
group: "{{ primary_group }}"
state: directory
mode: '0711'
- name: promtail config copy
template:
src: ../templates/promtail-config.yml
dest: "{{ docker_homepath }}/promtail-data/promtail-config.yml"
owner: "{{ user}}"
group: "{{ primary_group }}"
mode: '0644'
- name: loki
community.docker.docker_container:
name: loki
user: "{{ uid }}:{{ gid }}"
image: 'grafana/loki:main-2c878c8'
restart_policy: unless-stopped
#ports:
# - '3100:3100'
volumes:
- "{{ docker_homepath }}/loki-data:/loki"
- "/etc/resolv.conf:/etc/resolv.conf:ro"
- "/etc/timezone:/etc/timezone:ro"
- "/etc/localtime:/etc/localtime:ro"
networks:
- name: http
- name: grafana
community.docker.docker_container:
name: grafana
image: 'grafana/grafana:10.2.6'
user: "{{ uid }}:{{ gid }}"
restart_policy: unless-stopped
#ports:
# - '3000:3000'
volumes:
- "{{ docker_homepath }}/grafana-data:/var/lib/grafana"
- "/etc/timezone:/etc/timezone:ro"
- "/etc/localtime:/etc/localtime:ro"
networks:
- name: http
- name: promtail
community.docker.docker_container:
name: promtail
image: 'grafana/promtail:main-e2952b9'
user: "0:0"
restart_policy: unless-stopped
command: -config.file=/etc/promtail/promtail-config.yml -config.expand-env=true
#ports:
# - '3000:3000'
volumes:
- "{{ docker_homepath }}/promtail-data:/etc/promtail"
- "/var/log:/var/log:ro"
- "/run/log/journal/:/run/log/journal/:ro"
- "/etc/machine-id:/etc/machine-id:ro"
- "/etc/timezone:/etc/timezone:ro"
- "/etc/localtime:/etc/localtime:ro"
networks:
- name: http

View File

@@ -1,19 +0,0 @@
---
- name: nextcloud
community.docker.docker_container:
name: nextcloud
image: nextcloud:26.0-fpm
restart_policy: always
# ports:
# - 8080:80
volumes:
- "{{ docker_homepath }}/nextcloud_nextcloud_1/_data:/var/www/html"
env:
MYSQL_PASSWORD: "{{ NEXTCLOUD_MYSQL_PASSWORD }}"
MYSQL_DATABASE: "{{ NEXTCLOUD_MYSQL_DATABASE }}"
MYSQL_USER: "{{ NEXTCLOUD_MYSQL_USER }}"
MYSQL_HOST: "{{ mysql_host }}"
PHP_MEMORY_LIMIT: 2G
PHP_UPLOAD_LIMIT: 10G
networks:
- name: http

View File

@@ -1,16 +0,0 @@
---
- name: nginx
community.docker.docker_container:
name: nginx
image: 'jc21/nginx-proxy-manager:latest'
restart_policy: unless-stopped
ports:
- '80:80'
#- "{{ ip_admin }}:81:81"
- '443:443'
volumes:
- "{{ docker_homepath }}/data:/data"
- "{{ docker_homepath }}/letsencrypt:/etc/letsencrypt"
- "/bigpool/nextcloud/nextcloud_nextcloud_1/_data/:/var/www/html:ro"
networks:
- name: http

View File

@@ -1,20 +0,0 @@
- name: pi-hole
community.docker.docker_container:
name: pi-hole
image: pihole/pihole:2024.03.2
# For DHCP it is recommended to remove these ports and instead add: network_mode: "host"
ports:
- "53:53/tcp"
- "53:53/udp"
# - "8092:80/tcp"
env:
TZ: 'Europe/Prague'
WEBPASSWORD: "{{ password }}"
# Volumes store your data between container upgrades
volumes:
- "{{ docker_homepath }}/etc-pihole:/etc/pihole"
- "{{ docker_homepath }}/etc-dnsmasq.d:/etc/dnsmasq.d"
# https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
restart_policy: unless-stopped
networks:
- name: http

View File

@@ -1,24 +0,0 @@
---
- name: transmission
community.docker.docker_container:
name: transmission
image: lscr.io/linuxserver/transmission:latest
#container_name: transmission
env:
PUID: "{{ uid }}"
PGID: "{{ uid }}"
TZ: Europe/Berlin
#TRANSMISSION_WEB_HOME=/combustion-release/ #optional
USER: "{{ user }}" #optional
PASS: "{{ password }}" #optional
volumes:
# - /path/to/data:/config
- "{{ docker_homepath }}/downloads:/downloads"
- "{{ docker_homepath }}/watch:/watch"
#ports:
# - 9091:9091
# - 51413:51413
# - 51413:51413/udp
restart_policy: unless-stopped
networks:
- name: http

View File

@@ -1,60 +0,0 @@
server:
http_listen_port: 9080
grpc_listen_port: 0
positions:
filename: /tmp/positions.yaml
clients:
- url: http://loki:3100/loki/api/v1/push
#- url: https://loki.internal.matous.vondrejka.cz/loki/api/v1/push
scrape_configs:
- job_name: journal
journal:
json: false
max_age: 12h
path: /var/log/journal
labels:
job: systemd-journal
relabel_configs:
- source_labels: ['__journal__systemd_unit']
target_label: 'unit'
- job_name: docker
static_configs:
- targets:
- localhost
labels:
job: containerlogs
__path__: /var/lib/docker/containers/*/*log
pipeline_stages:
- json:
expressions:
output: log
stream: stream
attrs:
- json:
expressions:
tag:
source: attrs
- regex:
expression: (?P<image_name>(?:[^|]*[^|])).(?P<container_name>(?:[^|]*[^|])).(?P<image_id>(?:[^|]*[^|])).(?P<container_id>(?:[^|]*[^|]))
source: tag
- timestamp:
format: RFC3339Nano
source: time
- labels:
tag:
stream:
image_name:
container_name:
image_id:
container_id:
- output:
source: output/*-json.log
#scrape_configs:
#- job_name: journald
# journal: {}

View File

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

View File

@@ -1,5 +0,0 @@
---
- hosts: localhost
remote_user: root
roles:
- docker_spin_up

View File

@@ -1,2 +0,0 @@
---
# vars file for docker_spin_up