move directories into servers.yml

pull/20/head
Cian Hatton 3 years ago
parent d73ed64e82
commit 9dd5d48920

@ -4,8 +4,6 @@ backups:
monthly: "monthly" monthly: "monthly"
nightly: "nightly" nightly: "nightly"
docker_compose_directory: /etc/docker-compose
# TODO: docker_volume_backup exists in vault. Clean this up. # TODO: docker_volume_backup exists in vault. Clean this up.
dockervolumebackup: dockervolumebackup:
image: ghcr.io/chatton/docker-volume-backup image: ghcr.io/chatton/docker-volume-backup
@ -39,3 +37,19 @@ shares:
- /share/public_files - /share/public_files
- /share/private_files - /share/private_files
- /share/cian_files - /share/cian_files
directories:
# path on qnap where downloads go
downloads_dir: /mnt/ssd0/downloads
# path on qnap where plex transcoding happens
transcoding_dir: /mnt/ssd0/transcoding
# path on qnap where movies are stored
movies_dir: /mnt/mergerfs/media/movies
# path on qnap where tv shows are stored
tv_dir: /mnt/mergerfs/media/tv
# path on qnap where docker compose files are stored
docker_compose_directory: /etc/docker-compose
# path on qnap where backups are stored
backups_dir: /mnt/mergerfs/backups
# path where photoprism photos are stored
photoprism_dir: /mnt/mergerfs/photoprism

@ -1,12 +1,12 @@
# group qnap and linode to run operations on. # group qnap and linode to run operations on.
# this ensures we don't run everything on localhost as well. # this ensures we don't run everything on localhost as well.
[servers:children] [servers:children]
qnap qnaps
linode linodes
[qnap] [qnaps]
qnap qnap
# BEGIN ANSIBLE MANAGED BLOCK # BEGIN ANSIBLE MANAGED BLOCK
[linode] [linodes]
# END ANSIBLE MANAGED BLOCK # END ANSIBLE MANAGED BLOCK

@ -0,0 +1,53 @@
galaxy_info:
author: Cian Hatton
namespace: chatton
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: MIT
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.

@ -1,53 +1,10 @@
galaxy_info: galaxy_info:
author: Cian Hatton author: Cian Hatton
namespace: chatton namespace: chatton
description: your role description description: Bootstrap ansible
company: your company (optional) 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: MIT license: MIT
min_ansible_version: 2.1 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: [] 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: [] dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

@ -1,16 +1 @@
--- ---
qnap:
# path on qnap where downloads go
downloads_dir: /mnt/ssd0/downloads
# path on qnap where plex transcoding happens
transcoding_dir: /mnt/ssd0/transcoding
# path on qnap where movies are stored
movies_dir: /mnt/mergerfs/media/movies
# path on qnap where tv shows are stored
tv_dir: /mnt/mergerfs/media/tv
# path on qnap where docker compose files are stored
docker_compose_directory: /etc/docker-compose
# path on qnap where backups are stored
backups_dir: /mnt/mergerfs/backups
# path where photoprism photos are stored
photoprism_dir: /mnt/mergerfs/photoprism

@ -9,7 +9,7 @@
- name: Docker Compose | Create a directory if it does not exist - name: Docker Compose | Create a directory if it does not exist
file: file:
path: "{{qnap.docker_compose_directory}}/{{item.name}}" path: "{{directories.docker_compose_directory}}/{{item.name}}"
state: directory state: directory
mode: '0755' mode: '0755'
with_items: "{{services}}" with_items: "{{services}}"
@ -17,11 +17,11 @@
- name: Docker Compose | Template Docker Compose Files - name: Docker Compose | Template Docker Compose Files
template: template:
src: "{{item.name}}.j2" src: "{{item.name}}.j2"
dest: "{{qnap.docker_compose_directory}}/{{item.name}}/docker-compose.yml" dest: "{{directories.docker_compose_directory}}/{{item.name}}/docker-compose.yml"
with_items: "{{services}}" with_items: "{{services}}"
- name: Config Files | Create a directory if it does not exist - name: Directories | Ensure required directories
file: file:
path: "{{item}}" path: "{{item}}"
state: directory state: directory
@ -30,6 +30,7 @@
- "{{dashy.config_directory}}" - "{{dashy.config_directory}}"
- "{{olivetin.config_directory}}" - "{{olivetin.config_directory}}"
- "{{dockervolumebackup.config_directory}}" - "{{dockervolumebackup.config_directory}}"
- "{{directories.backups_dir}}/.s3tmp"
- name: Dashy | Config Files - name: Dashy | Config Files
copy: copy:
@ -69,7 +70,7 @@
environment: environment:
EXISTING_VOLUMES: "{{ find_volumes.results | map(attribute='stdout_lines') | list | flatten }}" EXISTING_VOLUMES: "{{ find_volumes.results | map(attribute='stdout_lines') | list | flatten }}"
SERVICES: "{{ services }}" SERVICES: "{{ services }}"
DOCKER_COMPOSE_DIR: "{{qnap.docker_compose_directory}}" DOCKER_COMPOSE_DIR: "{{directories.docker_compose_directory}}"
args: args:
executable: python3 executable: python3
register: python_output register: python_output
@ -107,7 +108,7 @@
chatton.portainer.portainer_stack: chatton.portainer.portainer_stack:
username: admin username: admin
password: "{{portainer.password}}" password: "{{portainer.password}}"
docker_compose_file_path: "{{qnap.docker_compose_directory}}/{{ item.name }}/docker-compose.yml" docker_compose_file_path: "{{directories.docker_compose_directory}}/{{ item.name }}/docker-compose.yml"
stack_name: "{{ item.name }}" stack_name: "{{ item.name }}"
endpoint_id: "{{ item.endpoint_id }}" endpoint_id: "{{ item.endpoint_id }}"
state: present state: present
@ -116,6 +117,6 @@
- name: Docker compose | Update Stack - name: Docker compose | Update Stack
when: container_deployment_mode == "compose" when: container_deployment_mode == "compose"
docker_compose: docker_compose:
project_src: "{{qnap.docker_compose_directory}}/{{ item.name }}" project_src: "{{directories.docker_compose_directory}}/{{ item.name }}"
state: present state: present
with_items: "{{services}}" with_items: "{{services}}"

@ -16,6 +16,6 @@ services:
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
- {{qnap.backups_dir}}:/backups - {{directories.backups_dir}}:/backups
- /tmp:/tmp - /tmp:/tmp
- {{dockervolumebackup.config_directory}}/config.yml:{{dockervolumebackup.config_directory}}/config.yml - {{dockervolumebackup.config_directory}}/config.yml:{{dockervolumebackup.config_directory}}/config.yml

@ -7,11 +7,11 @@ periodic_backups:
- name: "Nightly backup to local filesystem" - name: "Nightly backup to local filesystem"
type: "filesystem" type: "filesystem"
filesystem_options: filesystem_options:
host_path: {{ qnap.backups_dir }} host_path: {{ directories.backups_dir }}
- name: "Backup to iDrive E2" - name: "Backup to iDrive E2"
type: "s3" type: "s3"
s3_options: s3_options:
host_path: {{ qnap.backups_dir }} host_path: {{ directories.backups_dir }}
aws_access_key_id: {{ docker_volume_backup.aws_access_key_id }} aws_access_key_id: {{ docker_volume_backup.aws_access_key_id }}
aws_secret_access_key: {{ docker_volume_backup.aws_secret_access_key }} aws_secret_access_key: {{ docker_volume_backup.aws_secret_access_key }}
aws_default_region: {{ docker_volume_backup.aws_default_region }} aws_default_region: {{ docker_volume_backup.aws_default_region }}
@ -24,11 +24,11 @@ periodic_backups:
- name: "Monthly backup to local filesystem" - name: "Monthly backup to local filesystem"
type: "filesystem" type: "filesystem"
filesystem_options: filesystem_options:
host_path: {{ qnap.backups_dir }} host_path: {{ directories.backups_dir }}
- name: "Backup to iDrive E2" - name: "Backup to iDrive E2"
type: "s3" type: "s3"
s3_options: s3_options:
host_path: {{ qnap.backups_dir }} host_path: {{ directories.backups_dir }}
aws_access_key_id: {{ docker_volume_backup.aws_access_key_id }} aws_access_key_id: {{ docker_volume_backup.aws_access_key_id }}
aws_secret_access_key: {{ docker_volume_backup.aws_secret_access_key }} aws_secret_access_key: {{ docker_volume_backup.aws_secret_access_key }}
aws_default_region: {{ docker_volume_backup.aws_default_region }} aws_default_region: {{ docker_volume_backup.aws_default_region }}

@ -43,9 +43,9 @@ services:
- "/dev/dri:/dev/dri" # Intel QSV - "/dev/dri:/dev/dri" # Intel QSV
working_dir: "/photoprism" # do not change or remove working_dir: "/photoprism" # do not change or remove
volumes: volumes:
- {{ qnap.photoprism_dir}}/originals:/photoprism/originals # Original media files (DO NOT REMOVE) - {{ directories.photoprism_dir}}/originals:/photoprism/originals # Original media files (DO NOT REMOVE)
- {{ qnap.photoprism_dir}}/import:/photoprism/import # *Optional* base folder from which files can be imported to originals - {{ directories.photoprism_dir}}/import:/photoprism/import # *Optional* base folder from which files can be imported to originals
- {{ qnap.photoprism_dir}}/storage:/photoprism/storage # *Writable* storage folder for cache, database, and sidecar files (DO NOT REMOVE) - {{ directories.photoprism_dir}}/storage:/photoprism/storage # *Writable* storage folder for cache, database, and sidecar files (DO NOT REMOVE)
networks: networks:

@ -16,9 +16,9 @@ services:
- VERSION=docker - VERSION=docker
volumes: volumes:
- config:/config - config:/config
- {{ qnap.tv_dir }}:/tv - {{ directories.tv_dir }}:/tv
- {{ qnap.movies_dir }}:/movies - {{ directories.movies_dir }}:/movies
- {{ qnap.transcoding_dir }}:/transcoding - {{ directories.transcoding_dir }}:/transcoding
restart: unless-stopped restart: unless-stopped
devices: devices:
- /dev/dri:/dev/dri - /dev/dri:/dev/dri

@ -48,7 +48,7 @@ services:
- WEBUI_PORT=15000 - WEBUI_PORT=15000
volumes: volumes:
- qbittorrent_config:/config - qbittorrent_config:/config
- {{ qnap.downloads_dir }}:/downloads - {{ directories.downloads_dir }}:/downloads
restart: unless-stopped restart: unless-stopped
radarr: radarr:
@ -66,8 +66,8 @@ services:
- TZ=Europe/London - TZ=Europe/London
volumes: volumes:
- radarr_config:/config - radarr_config:/config
- {{ qnap.movies_dir }}:/movies - {{ directories.movies_dir }}:/movies
- {{ qnap.downloads_dir }}:/downloads - {{ directories.downloads_dir }}:/downloads
restart: unless-stopped restart: unless-stopped
sonarr: sonarr:
@ -85,8 +85,8 @@ services:
- TZ=Europe/London - TZ=Europe/London
volumes: volumes:
- sonarr_config:/config - sonarr_config:/config
- {{ qnap.tv_dir }}:/tv - {{ directories.tv_dir }}:/tv
- {{ qnap.downloads_dir }}:/downloads - {{ directories.downloads_dir }}:/downloads
restart: unless-stopped restart: unless-stopped
jackett: jackett:
@ -105,7 +105,7 @@ services:
- AUTO_UPDATE=true - AUTO_UPDATE=true
volumes: volumes:
- jackett_config:/config - jackett_config:/config
- {{ qnap.downloads_dir }}:/downloads - {{ directories.downloads_dir }}:/downloads
restart: unless-stopped restart: unless-stopped
volumes: volumes:

@ -9,14 +9,14 @@
--- ---
- name: Portainer | Create directory if it does not exist - name: Portainer | Create directory if it does not exist
ansible.builtin.file: ansible.builtin.file:
path: "{{docker_compose_directory}}" path: "{{directories.docker_compose_directory}}"
state: directory state: directory
mode: '0755' mode: '0755'
- name: Portainer | Copy docker compose file - name: Portainer | Copy docker compose file
copy: copy:
src: docker-compose.yml src: docker-compose.yml
dest: "{{docker_compose_directory}}/docker-compose.yml" dest: "{{directories.docker_compose_directory}}/docker-compose.yml"
- name: Portainer | Check if volume exists - name: Portainer | Check if volume exists
shell: docker volume ls -f name=portainer_portainer_data --format '{{ '{{' }} .Name {{ '}}' }}' shell: docker volume ls -f name=portainer_portainer_data --format '{{ '{{' }} .Name {{ '}}' }}'
@ -53,7 +53,7 @@
- name: Portainer | Docker compose up - name: Portainer | Docker compose up
community.docker.docker_compose: community.docker.docker_compose:
project_src: "{{docker_compose_directory}}/portainer" project_src: "{{directories.docker_compose_directory}}/portainer"
# Don't really need this as long as there is an S3 backup. # Don't really need this as long as there is an S3 backup.
#- name: Portainer | Register Admin User #- name: Portainer | Register Admin User

@ -26,7 +26,7 @@
- role: 'roles/setup_hosted_services' - role: 'roles/setup_hosted_services'
tags: ["services"] tags: ["services"]
- hosts: linode - hosts: linodes
become: true become: true
pre_tasks: pre_tasks:

@ -1,5 +1,5 @@
--- ---
- hosts: linode - hosts: linodes
tasks: tasks:
# TODO # TODO
# Verify sudoers # Verify sudoers

Loading…
Cancel
Save