Skip to content

Commit

Permalink
Add Authelia & switch Borgmatic to use Cron (systemd timer broke???)
Browse files Browse the repository at this point in the history
  • Loading branch information
stilktf committed Oct 6, 2024
1 parent ba2a095 commit d3de33b
Show file tree
Hide file tree
Showing 8 changed files with 559 additions and 230 deletions.
38 changes: 38 additions & 0 deletions authelia.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
- name: Setup Authelia using Docker
hosts: myhosts
become: true
vars_files:
- vault.yml

tasks:
- name: Do prereqs
ansible.builtin.include_role:
name: docker_prereqs

- name: Copy config file for Authelia
ansible.builtin.template:
src: extra/authelia.yml.j2
dest: /opt/authelia/config/configuration.yml
mode: "0644"

- name: Copy user config file for Authelia
ansible.builtin.template:
src: extra/authelia_users.yml.j2
dest: /opt/authelia/config/users_database.yml
mode: "0644"

- name: Copy Compose file over
ansible.builtin.template:
src: compose/authelia/compose.yml.j2
dest: /opt/authelia/compose.yml
mode: "0644"

- name: Start Authelia from compose
community.docker.docker_compose_v2:
project_src: /opt/authelia/
register: output

- name: Show results of compose
ansible.builtin.debug:
var: output
4 changes: 2 additions & 2 deletions borg-backup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
roles:
- role: borgbase.ansible_role_borgbackup
ansible_role_borgbackup_borg_encryption_passphrase: "{{ borg_backup_passphrase_vw }}"
ansible_role_borgbackup_borg_repository:
borg_repository: # noqa var-naming[no-role-prefix]
- /mnt/synology/backups/vw.borg
ansible_role_borgbackup_borg_source_directories:
- /opt/vaultwarden/data
Expand Down Expand Up @@ -52,4 +52,4 @@
keep_daily: 7
keep_weekly: 4
keep_monthly: 6
ansible_role_borgbackup_borgmatic_timer: systemd
ansible_role_borgbackup_borgmatic_timer: cron
10 changes: 10 additions & 0 deletions compose/authelia/compose.yml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
services:
authelia:
container_name: 'authelia'
image: 'docker.io/authelia/authelia:latest'
restart: 'unless-stopped'
ports:
- 9091:9091
volumes:
- '/opt/authelia/config:/config'
5 changes: 5 additions & 0 deletions extra/Caddyfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ push.stilk.tf {
reverse_proxy :8098 # ntfy
}

auth.stilk.tf {
import common
reverse_proxy :9091 # Authelia
}

tiles.stilk.tf {
import common
root * /var/www/tiles
Expand Down
34 changes: 34 additions & 0 deletions extra/authelia.yml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
totp:
issuer: 'push.stilk.tf'
identity_validation:
reset_password:
jwt_secret: '{{ authelia_jwt_secret }}'
authentication_backend:
refresh_interval: '5m'
password_reset:
disable: false
file:
path: '/config/users_database.yml'
session:
secret: '{{ authelia_session_secret }}'
name: 'authelia_session'
same_site: 'lax'
inactivity: '5m'
expiration: '1h'
remember_me: '1M'
cookies:
- domain: 'stilk.tf'
authelia_url: 'https://auth.stilk.tf'
remember_me: '1d'
notifier:
filesystem:
filename: '/config/notification.txt'
storage:
encryption_key: '{{ authelia_storage_secret }}'
local:
path: '/config/db.sqlite3'
access_control:
default_policy: deny
rules:
- domain: "*.stilk.tf"
policy: two_factor
10 changes: 10 additions & 0 deletions extra/authelia_users.yml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
users:
{{ authelia_user_username }}:
disabled: false
displayname: '{{authelia_user_displayname}}'
password: '{{authelia_user_password}}'
email: '{{authelia_user_email}}'
groups:
- 'admins'
---
7 changes: 7 additions & 0 deletions roles/docker_prereqs/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- name: Install prerequisite Python packages for the Ansible module for Docker
ansible.builtin.apt:
name: python3-requests
- name: Check if Docker is installed on system
ansible.builtin.command: docker --version
register: docker_valid
changed_when: docker_valid.rc != 0
681 changes: 453 additions & 228 deletions vault.yml

Large diffs are not rendered by default.

0 comments on commit d3de33b

Please sign in to comment.