Skip to content

Commit 5643e37

Browse files
author
Gianni Stubbe
committed
feat: Added dawarich role
1 parent 5a06909 commit 5643e37

19 files changed

Lines changed: 512 additions & 3 deletions

File tree

.github/workflows/ansible.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
name: Ansible validation
3+
4+
on:
5+
pull_request: true
6+
push:
7+
branches:
8+
- main
9+
10+
jobs:
11+
validate:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-python@v5
16+
with:
17+
python-version: '3.x'
18+
- name: Install Ansible tooling
19+
run: python -m pip install --requirement requirements.txt molecule molecule-docker
20+
- name: Install Ansible collections
21+
run: ansible-galaxy collection install --requirements-file requirements.yml
22+
- name: Lint YAML
23+
run: yamllint .
24+
- name: Lint Ansible
25+
run: ansible-lint
26+
- name: Syntax check Dawarich playbook
27+
run: ansible-playbook --syntax-check playbooks/dawarich.yml
28+
- name: Test Dawarich role
29+
env:
30+
ANSIBLE_ALLOW_BROKEN_CONDITIONALS: 'true'
31+
run: molecule test --scenario-name dawarich

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
*.pem
22
.venv/
33
.ansible
4+
__pycache__/
5+
*.py[cod]

molecule/dawarich/cleanup.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
- name: Cleanup Dawarich test dependencies
3+
hosts: localhost
4+
gather_facts: false
5+
tasks:
6+
- name: Remove Dawarich test containers
7+
community.docker.docker_container:
8+
name: "{{ item }}"
9+
state: absent
10+
loop:
11+
- dawarich_app
12+
- dawarich_db
13+
- dawarich_sidekiq
14+
- valkey
15+
16+
- name: Remove Dawarich test network
17+
community.docker.docker_network:
18+
name: molecule-services
19+
state: absent
20+
21+
- name: Remove Dawarich test volumes
22+
community.docker.docker_volume:
23+
name: "{{ item }}"
24+
state: absent
25+
loop:
26+
- data_dawarich_db
27+
- data_dawarich_shared
28+
- data_dawarich_public
29+
- data_dawarich_watched
30+
- data_dawarich_storage

molecule/dawarich/converge.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
- name: Converge Dawarich role
3+
hosts: all
4+
gather_facts: false
5+
vars:
6+
dawarich_database_password: molecule-dawarich-password
7+
dawarich_secret_key_base: molecule-dawarich-secret-key
8+
authelia_oidc_clients:
9+
dawarich:
10+
client_id: dawarich
11+
client_secret: molecule-dawarich-client-secret
12+
dawarich_container_state: "{{ lookup('env', 'DAWARICH_CONTAINER_STATE') | default('healthy', true) }}"
13+
dawarich_postgres_image: imresamu/postgis
14+
dawarich_services_network: molecule-services
15+
dawarich_dns_servers: []
16+
roles:
17+
- role: dawarich

molecule/dawarich/molecule.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
driver:
3+
name: docker
4+
5+
scenario:
6+
test_sequence:
7+
- destroy
8+
- syntax
9+
- create
10+
- prepare
11+
- converge
12+
- idempotence
13+
- verify
14+
- cleanup
15+
- destroy
16+
17+
platforms:
18+
- name: dawarich-instance
19+
image: geerlingguy/docker-debian12-ansible:latest
20+
pre_build_image: true
21+
privileged: true
22+
volumes:
23+
- /var/run/docker.sock:/var/run/docker.sock
24+
25+
provisioner:
26+
name: ansible
27+
playbooks:
28+
prepare: prepare.yml
29+
inventory:
30+
host_vars:
31+
dawarich-instance:
32+
ansible_python_interpreter: /usr/bin/python3
33+
34+
verifier:
35+
name: ansible

molecule/dawarich/prepare.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
- name: Prepare Dawarich dependencies
3+
hosts: all
4+
gather_facts: false
5+
become: true
6+
vars:
7+
molecule_services_network: molecule-services
8+
tasks:
9+
- name: Install Docker SDK dependencies
10+
ansible.builtin.apt:
11+
name:
12+
- python3-docker
13+
- python3-requests
14+
state: present
15+
update_cache: true
16+
17+
- name: Create shared services network
18+
community.docker.docker_network:
19+
name: "{{ molecule_services_network }}"
20+
21+
- name: Start shared Valkey
22+
community.docker.docker_container:
23+
name: valkey
24+
image: ghcr.io/valkey-io/valkey:alpine
25+
networks:
26+
- name: "{{ molecule_services_network }}"
27+
state: started

molecule/dawarich/verify.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
- name: Verify Dawarich deployment
3+
hosts: all
4+
gather_facts: false
5+
vars:
6+
dawarich_container_state: "{{ lookup('env', 'DAWARICH_CONTAINER_STATE') | default('healthy', true) }}"
7+
tasks:
8+
- name: Inspect Dawarich containers
9+
community.docker.docker_container_info:
10+
name: "{{ item }}"
11+
loop:
12+
- dawarich_db
13+
- dawarich_app
14+
- dawarich_sidekiq
15+
register: dawarich_containers
16+
17+
- name: Assert Dawarich containers are running
18+
ansible.builtin.assert:
19+
that:
20+
- item.container.State.Status == 'running'
21+
- >-
22+
dawarich_container_state == 'started' or
23+
item.container.State.Health.Status == 'healthy'
24+
loop: "{{ dawarich_containers.results }}"
25+
26+
- name: Inspect shared Valkey
27+
community.docker.docker_container_info:
28+
name: valkey
29+
register: valkey_container
30+
31+
- name: Assert shared Valkey is running
32+
ansible.builtin.assert:
33+
that: valkey_container.container.State.Status == 'running'

playbooks/dawarich.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
- name: Setup shared Valkey and Dawarich
3+
hosts: BEOKPDCOVM01
4+
connection: ssh
5+
become: true
6+
roles:
7+
- role: valkey
8+
tags: valkey
9+
- role: dawarich
10+
tags: dawarich

playbooks/group_vars/all.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ domain:
174174
answer: "{{ traefik.dco.ip }}"
175175
- domain: "beokpdcosv01.frai.se"
176176
answer: "{{ traefik.dco.ipv6 }}"
177+
- domain: "location.frai.se"
178+
answer: "{{ traefik.dco.ip }}"
179+
- domain: "location.frai.se"
180+
answer: "{{ traefik.dco.ipv6 }}"
177181
- domain: unifi.unitix.be
178182
answer: "{{ traefik.dco.ipv6 }}"
179183
- domain: unifi.unitix.be
@@ -507,6 +511,14 @@ authelia_bypass_header: !vault |
507511
6232393131383065650a393164636630316431663730626333653563663430376663613133306365
508512
66613631313636633566386162366337306334313435346138613634656161633136623336643133
509513
3265616263326664356165616531303162323161326363313232
514+
authelia_oidc_client_secret_salt: !vault |
515+
$ANSIBLE_VAULT;1.1;AES256
516+
38633066646566333433386637303031666639656261316438393061323963666430666134376661
517+
6332626265626564366639346234613530656135663934320a376134316666303162653133343661
518+
30613738383230646530376564333839636636633865303539393062383533343937303463393066
519+
6466653936666539390a333139616233353966663630633461353337343765653631316131396231
520+
63383034386564633330393839316463333232623563623961356134653038306565646433356636
521+
3137633836623833623562396431353964373965326438353035
510522
authelia_oidc_clients:
511523
immich:
512524
client_id: !vault |
@@ -533,3 +545,24 @@ authelia_oidc_clients:
533545
35643562386264353464383831303734376139353131313365393966356664363036366266383430
534546
36386532316165313033656662393661326639353663336536663930643366383866316339633231
535547
353061376235393134323932323037336237
548+
dawarich:
549+
client_id: !vault |
550+
$ANSIBLE_VAULT;1.1;AES256
551+
37633563376361316561383366636239346163396230656233353765323931656131376130633739
552+
3033373230373830333435336164383665373565373033610a353333663938353435303864616430
553+
33626334376466613665663562663233316638323662646538353438356233343035383837396433
554+
3766366364663333330a366537306530366431656265306363353133303831646263393833646336
555+
65353835356565336464386537316636373530393736343765393737656665376439386138636137
556+
37613266396362666530316333666330623731363462316534616161656138623966636334383663
557+
64393464353261616266363531653038356639356130393938613833633633613162323062376166
558+
32306238616364393231
559+
client_secret: !vault |
560+
$ANSIBLE_VAULT;1.1;AES256
561+
64323430643765303639313337653166333361643531326134646535613963303461313233343763
562+
3939393566636162666330306466326635343832376637310a303762343531336265386438633634
563+
64623366303237323430333538663337373939663733313132363462356132386538343438353734
564+
3534366334326463620a353565646536653564616566366461633566656666383737393138363738
565+
39306330636537383462656131366662643835663530316537626235636639373636316638303539
566+
33656462653730306433623231646663353136363534313365353236623636643335323761666632
567+
61663765396237356639333531353239316538383531356562643733346134316638366164326132
568+
61393833386366363732

playbooks/host_vars/beokpdcovm01.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,24 @@ influxdb_admin_token: !vault |
5252
36333934393439373761666661633739383137663162646366313766303262366164653731373337
5353
35393366636539663964646364626538353462353364363534386466656562623263323061316666
5454
333538666631636538633736386133613664
55+
56+
dawarich_database_password: !vault |
57+
$ANSIBLE_VAULT;1.1;AES256
58+
64303830393562636630316134626439663065386562343932373935333663373830653332636665
59+
3135346466323666393737633539346631346636643131310a303166346263323139303932356462
60+
38313463323930336431623964373362393662393564306462326236636539613465623662633365
61+
6263663938333033330a616439323165656662336131336535316461386365333039363961633936
62+
64393437333635323439303065333231313639653233313530616262376632346138
63+
dawarich_secret_key_base: !vault |
64+
$ANSIBLE_VAULT;1.1;AES256
65+
39653535353131633832623635613839313633616331333335363635333264393432633530316165
66+
3964653965363735343539303038346237373439353266370a313165366331353962383261323362
67+
66303035323030373963333331326266333235363461613437373663666533633231343835633038
68+
3166633139373266620a663337613864363736313230633763323363663537343934666463303961
69+
65373336323664636531666231323564306464386463663533326364303035393663363333633736
70+
38306232303631356137313034653062666661336135303662353561356137313432653663383435
71+
34636435316537646337656333356437383730613330653364363835316135653465303332333464
72+
65383363616533323561373363616365323566393036646366616165653137316231613665306236
73+
39376663393935313236616332656461666163363533643662633265363664633234313863636164
74+
37393136323364336337343764326464343037333537343035393563313336623130353939356365
75+
616365383732386265613234376665373732

0 commit comments

Comments
 (0)