Compare commits
12 Commits
4eed5621a6
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a247fff18 | ||
|
|
6f920e4497 | ||
|
|
a9aed98130 | ||
|
|
4ac07e10fd | ||
|
|
914b018e21 | ||
|
|
386bf8e5d7 | ||
|
|
18baf6aa7c | ||
|
|
29ee25fbef | ||
|
|
067a9bf39b | ||
|
|
679fcc75be | ||
|
|
d91ce47d4b | ||
|
|
9ff7b4b913 |
@@ -9,10 +9,10 @@ all:
|
|||||||
#vps2:
|
#vps2:
|
||||||
# ansible_host: 203.0.113.11
|
# ansible_host: 203.0.113.11
|
||||||
|
|
||||||
dbservers:
|
archivewarrior:
|
||||||
hosts:
|
hosts:
|
||||||
#vps3:
|
chi2:
|
||||||
# ansible_host: 203.0.113.12
|
ansible_host: 107.175.70.69
|
||||||
|
|
||||||
authelia:
|
authelia:
|
||||||
hosts:
|
hosts:
|
||||||
|
|||||||
13
roles/archivewarrior/defaults/main.yml
Normal file
13
roles/archivewarrior/defaults/main.yml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# User config
|
||||||
|
archive_user: jester45
|
||||||
|
archive_uid: 1024
|
||||||
|
archive_gid: 1024
|
||||||
|
|
||||||
|
# Path Configurations
|
||||||
|
base_app_dir: "/app/archivewarrior"
|
||||||
|
docker_dir: "/app/docker/archivewarrior"
|
||||||
|
data_dir: "/app/data/archivewarrior"
|
||||||
|
|
||||||
|
# Container Configuration
|
||||||
|
container_name: "archivewarrior"
|
||||||
|
image_version: "latest"
|
||||||
78
roles/archivewarrior/tasks/main.yml
Normal file
78
roles/archivewarrior/tasks/main.yml
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: Remove nginx, avoids port 80 conflict
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name: nginx
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Remove nginx service, avoids port 80 conflict
|
||||||
|
ansible.builtin.service:
|
||||||
|
name: nginx
|
||||||
|
state: stopped
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
- name: Create authelia directories
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ item }}"
|
||||||
|
state: directory
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0750"
|
||||||
|
loop:
|
||||||
|
- "{{ authelia_base_dir }}"
|
||||||
|
- "{{ authelia_config_dir }}"
|
||||||
|
- "{{ authelia_data_dir }}"
|
||||||
|
|
||||||
|
- name: Check if Caddyfile path is wrongly a directory
|
||||||
|
ansible.builtin.stat:
|
||||||
|
path: "{{ authelia_base_dir }}/Caddyfile"
|
||||||
|
register: caddyfile_stat
|
||||||
|
|
||||||
|
- name: Remove Caddyfile if it was created as a directory
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ authelia_base_dir }}/Caddyfile"
|
||||||
|
state: absent
|
||||||
|
when: caddyfile_stat.stat.exists and caddyfile_stat.stat.isdir
|
||||||
|
|
||||||
|
- name: Deploy Caddyfile
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: Caddyfile.j2
|
||||||
|
dest: "{{ authelia_base_dir }}/Caddyfile"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0640"
|
||||||
|
notify: restart authelia
|
||||||
|
|
||||||
|
- name: Deploy configuration.yml
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: configuration.yml.j2
|
||||||
|
dest: "{{ authelia_config_dir }}/configuration.yml"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0640"
|
||||||
|
notify: restart authelia
|
||||||
|
|
||||||
|
- name: Deploy users_database.yml
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: users_database.yml.j2
|
||||||
|
dest: "{{ authelia_config_dir }}/users_database.yml"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0640"
|
||||||
|
notify: restart authelia
|
||||||
|
when: authelia_users is defined
|
||||||
|
|
||||||
|
- name: Deploy docker-compose.yml
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: docker-compose.yml.j2
|
||||||
|
dest: "{{ authelia_base_dir }}/docker-compose.yml"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0640"
|
||||||
|
register: compose_file
|
||||||
|
|
||||||
|
- name: Pull and start authelia via docker compose
|
||||||
|
community.docker.docker_compose_v2:
|
||||||
|
project_src: "{{ authelia_base_dir }}"
|
||||||
|
state: present
|
||||||
|
pull: missing
|
||||||
98
roles/archivewarrior/templates/docker-compose.yml.j2
Normal file
98
roles/archivewarrior/templates/docker-compose.yml.j2
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
---
|
||||||
|
- name: Deploy ArchiveWarrior Docker Container
|
||||||
|
hosts: all
|
||||||
|
become: true
|
||||||
|
vars:
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
# ----------------------------------------------------
|
||||||
|
# 1. PREREQUISITES & DOCKER INSTALLATION
|
||||||
|
# ----------------------------------------------------
|
||||||
|
- name: Check if Docker is already installed
|
||||||
|
ansible.builtin.command: docker --version
|
||||||
|
register: docker_check
|
||||||
|
changed_when: false
|
||||||
|
failed_when: false
|
||||||
|
|
||||||
|
- name: Install Docker via convenience script if missing
|
||||||
|
ansible.builtin.shell: |
|
||||||
|
set -o pipefail
|
||||||
|
curl -fsSL https://docker.com | sh
|
||||||
|
args:
|
||||||
|
executable: /bin/bash
|
||||||
|
when: docker_check.rc != 0
|
||||||
|
changed_when: true
|
||||||
|
|
||||||
|
- name: Ensure Docker service is running and enabled
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
name: docker
|
||||||
|
state: started
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
# ----------------------------------------------------
|
||||||
|
# 2. USER & DIRECTORY CONFIGURATION
|
||||||
|
# ----------------------------------------------------
|
||||||
|
- name: Create dedicated group for ArchiveWarrior
|
||||||
|
ansible.builtin.group:
|
||||||
|
name: "{{ archive_user }}"
|
||||||
|
gid: "{{ archive_gid }}"
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Create dedicated system user for ArchiveWarrior
|
||||||
|
ansible.builtin.user:
|
||||||
|
name: "{{ archive_user }}"
|
||||||
|
uid: "{{ archive_uid }}"
|
||||||
|
group: "{{ archive_user }}"
|
||||||
|
groups: docker
|
||||||
|
append: true
|
||||||
|
shell: /usr/sbin/nologin
|
||||||
|
system: true
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Create persistent storage and layout directories
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ item }}"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ archive_user }}"
|
||||||
|
group: "{{ archive_user }}"
|
||||||
|
mode: '0755'
|
||||||
|
loop:
|
||||||
|
- "{{ base_app_dir }}"
|
||||||
|
- "{{ docker_dir }}"
|
||||||
|
- "{{ data_dir }}"
|
||||||
|
|
||||||
|
# ----------------------------------------------------
|
||||||
|
# 3. DOCKER COMPOSE DEPLOYMENT
|
||||||
|
# ----------------------------------------------------
|
||||||
|
- name: Write docker-compose.yml configuration file
|
||||||
|
ansible.builtin.copy:
|
||||||
|
dest: "{{ docker_dir }}/docker-compose.yml"
|
||||||
|
owner: "{{ archive_user }}"
|
||||||
|
group: "{{ archive_user }}"
|
||||||
|
mode: '0640'
|
||||||
|
content: |
|
||||||
|
version: '3.8'
|
||||||
|
services:
|
||||||
|
archivewarrior:
|
||||||
|
image: atdr.meo.ws/archiveteam/archivewarrior:${image_version}
|
||||||
|
container_name: ${container_name}
|
||||||
|
restart: unless-stopped
|
||||||
|
user: "${archive_uid}:${archive_gid}"
|
||||||
|
logging:
|
||||||
|
driver: "json-file"
|
||||||
|
options:
|
||||||
|
max-size: "10m"
|
||||||
|
max-file: "3"
|
||||||
|
volumes:
|
||||||
|
- ${data_dir}:/home/warrior/data
|
||||||
|
environment:
|
||||||
|
- DOWNLOADER=YourNameOrNickname
|
||||||
|
- SELECTED_PROJECT=auto
|
||||||
|
- CONCURRENT_ITEMS=6
|
||||||
|
|
||||||
|
- name: Pull and start ArchiveWarrior Docker container
|
||||||
|
# Using community.docker.docker_compose_v2 to handle stack management safely
|
||||||
|
community.docker.docker_compose_v2:
|
||||||
|
project_src: "{{ docker_dir }}"
|
||||||
|
state: present
|
||||||
|
pull: always
|
||||||
@@ -11,27 +11,30 @@ auth.{{ authelia_domain }} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
semaphore.frantecrt.duckdns.org {
|
semaphore.frantecrt.duckdns.org {
|
||||||
# Import the auth configuration block
|
# Webhook endpoint: skip Authelia, Semaphore's own integration auth protects it
|
||||||
import authelia_auth
|
@webhook path /api/integrations/*
|
||||||
|
handle @webhook {
|
||||||
# Route the traffic to your backend application if authenticated
|
|
||||||
reverse_proxy semaphore.netbird.cloud:3000
|
reverse_proxy semaphore.netbird.cloud:3000
|
||||||
|
}
|
||||||
|
|
||||||
|
# Everything else: protected by Authelia
|
||||||
|
handle {
|
||||||
|
import authelia_auth
|
||||||
|
reverse_proxy semaphore.netbird.cloud:3000
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
git.frantecrt.duckdns.org {
|
git.frantecrt.duckdns.org {
|
||||||
# Import the auth configuration block
|
# Import the auth configuration block
|
||||||
import authelia_auth
|
|
||||||
|
|
||||||
# Route the traffic to your backend application if authenticated
|
# Route the traffic to your backend application if authenticated
|
||||||
reverse_proxy gitea.netbird.cloud:3000
|
reverse_proxy gitea.netbird.cloud:3000
|
||||||
}
|
}
|
||||||
|
|
||||||
wikijs.frantecrt.duckdns.org {
|
wikijs.frantecrt.duckdns.org {
|
||||||
# Import the auth configuration block
|
# Not using authelia_auth as it breaks the app's login page.
|
||||||
import authelia_auth
|
|
||||||
|
|
||||||
# Route the traffic to your backend application if authenticated
|
|
||||||
reverse_proxy wikijs.netbird.cloud:3000
|
reverse_proxy wikijs.netbird.cloud:3000
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vault.frantecrt.duckdns.org {
|
vault.frantecrt.duckdns.org {
|
||||||
@@ -40,3 +43,19 @@ vault.frantecrt.duckdns.org {
|
|||||||
reverse_proxy /notifications/hub* wikijs.netbird.cloud:3012
|
reverse_proxy /notifications/hub* wikijs.netbird.cloud:3012
|
||||||
reverse_proxy /notifications/anonymous_hub* wikijs.netbird.cloud:3012
|
reverse_proxy /notifications/anonymous_hub* wikijs.netbird.cloud:3012
|
||||||
}
|
}
|
||||||
|
|
||||||
|
slskd.frantecrt.duckdns.org {
|
||||||
|
# Import the auth configuration block
|
||||||
|
import authelia_auth
|
||||||
|
|
||||||
|
# Route the traffic to your backend application if authenticated
|
||||||
|
reverse_proxy navidrome.netbird.cloud:5030
|
||||||
|
}
|
||||||
|
|
||||||
|
navidrome.frantecrt.duckdns.org {
|
||||||
|
# Import the auth configuration block
|
||||||
|
import authelia_auth
|
||||||
|
|
||||||
|
# Route the traffic to your backend application if authenticated
|
||||||
|
reverse_proxy navidrome.netbird.cloud:4533
|
||||||
|
}
|
||||||
|
|||||||
@@ -64,6 +64,14 @@ identity_providers:
|
|||||||
- alt_emails
|
- alt_emails
|
||||||
- preferred_username
|
- preferred_username
|
||||||
- name
|
- name
|
||||||
|
wikijs_claims_policy:
|
||||||
|
id_token:
|
||||||
|
- groups
|
||||||
|
- email
|
||||||
|
- email_verified
|
||||||
|
- alt_emails
|
||||||
|
- preferred_username
|
||||||
|
- name
|
||||||
clients:
|
clients:
|
||||||
- client_id: semaphore
|
- client_id: semaphore
|
||||||
client_name: Semaphore
|
client_name: Semaphore
|
||||||
@@ -71,6 +79,8 @@ identity_providers:
|
|||||||
claims_policy: semaphore_claims_policy
|
claims_policy: semaphore_claims_policy
|
||||||
public: false
|
public: false
|
||||||
authorization_policy: two_factor
|
authorization_policy: two_factor
|
||||||
|
consent_mode: 'pre-configured'
|
||||||
|
pre_configured_consent_duration: '12M' # Reask consent for data share 1 year after first login
|
||||||
redirect_uris:
|
redirect_uris:
|
||||||
- https://semaphore.{{ authelia_domain }}/api/auth/oidc/authelia/redirect
|
- https://semaphore.{{ authelia_domain }}/api/auth/oidc/authelia/redirect
|
||||||
scopes:
|
scopes:
|
||||||
@@ -81,16 +91,20 @@ identity_providers:
|
|||||||
- client_id: wikijs
|
- client_id: wikijs
|
||||||
client_name: Wiki
|
client_name: Wiki
|
||||||
client_secret: {{ wikijs_client_secret }}
|
client_secret: {{ wikijs_client_secret }}
|
||||||
|
claims_policy: wikijs_claims_policy
|
||||||
public: false
|
public: false
|
||||||
authorization_policy: 'two_factor'
|
authorization_policy: two_factor
|
||||||
|
consent_mode: 'pre-configured'
|
||||||
|
pre_configured_consent_duration: '12M' # Reask consent for data share 1 year after first login
|
||||||
require_pkce: false
|
require_pkce: false
|
||||||
pkce_challenge_method: ''
|
pkce_challenge_method: ''
|
||||||
redirect_uris:
|
redirect_uris:
|
||||||
- 'https://wikijs.{{ authelia_domain }}/login/{{ wikijs_uuid }}/callback' # Note this must be copied during step 7 of the Application configuration.
|
- 'https://wikijs.{{ authelia_domain }}/login/{{ wikijs_uuid }}/callback' # Note this must be copied during step 7 of the Application configuration.
|
||||||
scopes:
|
scopes:
|
||||||
- 'openid'
|
- openid
|
||||||
- 'profile'
|
- profile
|
||||||
- 'email'
|
- email
|
||||||
|
- groups
|
||||||
response_types:
|
response_types:
|
||||||
- 'code'
|
- 'code'
|
||||||
grant_types:
|
grant_types:
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "127.0.0.1:{{ authelia_port }}:{{ authelia_port }}"
|
- "127.0.0.1:{{ authelia_port }}:{{ authelia_port }}"
|
||||||
environment:
|
environment:
|
||||||
- TZ={{ ansible_facts.timezone | default('UTC') }}
|
- TZ={{ ansible_facts['timezone'] | default('UTC') }}
|
||||||
|
|
||||||
caddy:
|
caddy:
|
||||||
image: caddy:2
|
image: caddy:2
|
||||||
@@ -16,6 +16,7 @@ services:
|
|||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
network_mode: host
|
network_mode: host
|
||||||
volumes:
|
volumes:
|
||||||
|
- /etc/resolv.conf:/etc/resolv.conf:ro
|
||||||
- {{ authelia_base_dir }}/Caddyfile:/etc/caddy/Caddyfile
|
- {{ authelia_base_dir }}/Caddyfile:/etc/caddy/Caddyfile
|
||||||
- {{ authelia_data_dir }}/caddy_data:/data
|
- {{ authelia_data_dir }}/caddy_data:/data
|
||||||
- {{ authelia_data_dir }}/caddy_config:/config
|
- {{ authelia_data_dir }}/caddy_config:/config
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Install postgresql
|
|
||||||
ansible.builtin.apt:
|
|
||||||
name:
|
|
||||||
- "postgresql-{{ postgres_version }}"
|
|
||||||
- python3-psycopg2
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: Ensure postgresql is running and enabled
|
|
||||||
ansible.builtin.service:
|
|
||||||
name: postgresql
|
|
||||||
state: started
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
# - name: Create databases
|
|
||||||
# become_user: postgres
|
|
||||||
# community.postgresql.postgresql_db:
|
|
||||||
# name: "{{ item.name }}"
|
|
||||||
# loop: "{{ postgres_databases }}"
|
|
||||||
|
|
||||||
# - name: Create users
|
|
||||||
# become_user: postgres
|
|
||||||
# community.postgresql.postgresql_user:
|
|
||||||
# name: "{{ item.name }}"
|
|
||||||
# password: "{{ item.password }}"
|
|
||||||
# loop: "{{ postgres_users }}"
|
|
||||||
# no_log: true
|
|
||||||
7
site.yml
7
site.yml
@@ -20,11 +20,12 @@
|
|||||||
- docker
|
- docker
|
||||||
- nginx
|
- nginx
|
||||||
|
|
||||||
- name: Database servers
|
- name: archivewarrior servers
|
||||||
hosts: dbservers
|
hosts: archivewarrior
|
||||||
become: true
|
become: true
|
||||||
roles:
|
roles:
|
||||||
- postgres
|
- docker
|
||||||
|
- archivewarrior
|
||||||
|
|
||||||
- name: authelia servers
|
- name: authelia servers
|
||||||
hosts: authelia
|
hosts: authelia
|
||||||
|
|||||||
Reference in New Issue
Block a user