Add argus service for update management

This commit is contained in:
Tobias Reisinger 2026-11-14 14:40:01 +01:00
commit d0f96ef6cd
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
13 changed files with 208 additions and 6 deletions

View file

@ -31,10 +31,10 @@ tofu:
@printf "\n=====\n\n" @printf "\n=====\n\n"
$(MAKE) output $(MAKE) output
dns: output-dns dns: output
dnscontrol push dnscontrol push
dns-check: output-dns dns-check: output
dnscontrol check-creds ovh dnscontrol check-creds ovh
tofu-dns: tofu-dns:

View file

@ -0,0 +1,61 @@
---
argus_version_argus: 0.39.0
argus_confd_path: "{{ (service_path, 'conf.d') | path_join }}"
argus_github_token: "{{ undef() }}"
argus_service_ver: "" # Set when creating service config
argus_service_name: "" # Set when creating service config
argus_svc:
domain: "{{ all_services | service_get_domain(service_name) }}"
port: 8080
caddy_extra: import vpn_only
argus_yml:
settings:
web:
trusted_proxies:
- 0.0.0.0/0
auth:
enabled: false
data:
database_file: /app/data/argus.db
readonly: true
defaults:
service:
options:
interval: 2h
semantic_versioning: true
latest_version:
github:
access_token: "{{ argus_github_token }}"
deployed_version:
type: manual
allow_invalid_certs: false
dashboard:
auto_approve: false
argus_compose:
watchtower: update
image: releaseargus/argus:{{ argus_version_argus }}
volumes:
- ./config.yml:/app/config.yml
- data:/app/data/
file:
volumes:
data:
argus_ver:
service:
argus_argus:
latest_version:
type: github
url: release-argus/argus
deployed_version:
version: "{{ argus_version_argus }}"
dashboard:
icon: https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/argus.webp
web_url: !unsafe https://github.com/release-argus/Argus/releases/tag/{{ version }}

View file

@ -0,0 +1,6 @@
---
- name: Restart service argus
ansible.builtin.include_tasks: "{{ tasks_dir }}/restart-service.yml"
- name: Merge argus configs
ansible.builtin.include_tasks: tasks/merge-configs.yml

View file

@ -0,0 +1,15 @@
- name: Set common facts
ansible.builtin.include_tasks: "{{ tasks_dir }}/set-default-facts.yml"
- name: Create config.d directory
ansible.builtin.file:
path: "{{ argus_confd_path }}"
state: directory
mode: "0755"
- name: Create service config
ansible.builtin.copy:
dest: "{{ (argus_confd_path, argus_service_name + '.yml') | path_join }}"
content: "{{ argus_service_ver | to_nice_yaml }}"
mode: "0644"
notify: Merge argus configs

View file

@ -0,0 +1,32 @@
---
- name: Set common facts
ansible.builtin.include_tasks: "{{ tasks_dir }}/set-default-facts.yml"
- name: Deploy {{ service_name }}
vars:
svc: "{{ argus_svc }}"
env: "{{ argus_env }}"
compose: "{{ argus_compose }}"
ver: "{{ argus_ver }}"
block:
- name: Import prepare tasks for common service
ansible.builtin.include_tasks: "{{ tasks_dir }}/prepare-common-service.yml"
- name: Create config.d directory
ansible.builtin.file:
path: "{{ argus_confd_path }}"
state: directory
mode: "0755"
- name: Create base config
ansible.builtin.copy:
dest: "{{ (argus_confd_path, 'config.yml') | path_join }}"
content: "{{ argus_yml | to_nice_yaml }}"
mode: "0644"
notify: Merge argus configs
- name: Merge argus configs
ansible.builtin.include_tasks: tasks/merge-configs.yml
- name: Import start tasks for common service
ansible.builtin.include_tasks: "{{ tasks_dir }}/start-common-service.yml"

View file

@ -0,0 +1,12 @@
- name: Collect configs
ansible.builtin.shell:
cmd: yq ea '. as $item ireduce ({}; . * $item )' {{ (argus_confd_path, '*') | path_join }}
chdir: "{{ service_path }}"
register: argus_collected_conf
- name: Create config
ansible.builtin.copy:
dest: "{{ (service_path, 'config.yml') | path_join }}"
content: "{{ argus_collected_conf.stdout }}"
mode: "0644"
notify: Restart service argus

View file

@ -1,4 +1,6 @@
--- ---
forgejo_version_forgejo: 17.0.1
forgejo_server_lfs_jwt_secret: "{{ undef() }}" forgejo_server_lfs_jwt_secret: "{{ undef() }}"
forgejo_security_internal_token: "{{ undef() }}" forgejo_security_internal_token: "{{ undef() }}"
forgejo_security_secret_key: "{{ undef() }}" forgejo_security_secret_key: "{{ undef() }}"
@ -107,9 +109,8 @@ forgejo_ini:
SHOW_FOOTER_TEMPLATE_LOAD_TIME: false SHOW_FOOTER_TEMPLATE_LOAD_TIME: false
forgejo_compose: forgejo_compose:
watchtower: update
collect_logs: true collect_logs: true
image: codeberg.org/forgejo/forgejo:16 image: "codeberg.org/forgejo/forgejo:{{ forgejo_version_forgejo }}"
volumes: volumes:
- data:/data - data:/data
- ./app.ini:/data/gitea/conf/app.ini - ./app.ini:/data/gitea/conf/app.ini
@ -124,3 +125,20 @@ forgejo_compose:
- "{{ svc.ssh_port }}:{{ svc.ssh_port }}" - "{{ svc.ssh_port }}:{{ svc.ssh_port }}"
volumes: volumes:
data: data:
forgejo_ver:
service:
forgejo_forgejo:
latest_version:
type: forgejo
host: https://codeberg.org
url: forgejo/forgejo
url_commands:
- type: regex
regex: ^v?([0-9.]+)$
deployed_version:
version: "{{ forgejo_version_forgejo }}"
dashboard:
icon: https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/forgejo.webp
web_url: !unsafe https://codeberg.org/forgejo/forgejo/releases/tag/v{{ version }}

View file

@ -6,6 +6,7 @@
vars: vars:
svc: "{{ forgejo_svc }}" svc: "{{ forgejo_svc }}"
compose: "{{ forgejo_compose }}" compose: "{{ forgejo_compose }}"
ver: "{{ forgejo_ver }}"
block: block:
- name: Import prepare tasks for common service - name: Import prepare tasks for common service
ansible.builtin.include_tasks: "{{ tasks_dir }}/prepare-common-service.yml" ansible.builtin.include_tasks: "{{ tasks_dir }}/prepare-common-service.yml"

View file

@ -1,9 +1,20 @@
- name: Add debian backports repository
ansible.builtin.deb822_repository:
name: debian-backports
types: deb
uris: http://deb.debian.org/debian
suites: "{{ ansible_facts.lsb.codename }}-backports"
components:
- main
become: true
- name: Install wanted software - name: Install wanted software
ansible.builtin.apt: ansible.builtin.apt:
pkg: pkg:
- bzip2 - bzip2
- jq - jq
- unzip - unzip
- yq-go
- zsh - zsh
state: present state: present
update_cache: true update_cache: true

View file

@ -1,9 +1,20 @@
--- ---
- name: Prepare opentofu
hosts: localhost
gather_facts: false
tasks:
- name: Import tasks to prepare opentofu
ansible.builtin.import_tasks: tasks/prepare-opentofu.yml
- name: Stop and backup services - name: Stop and backup services
hosts: serguzim_net hosts: serguzim_net
vars: vars:
host_services: "{{ all_services | services_for_host(inventory_hostname) }}" host_services: "{{ all_services | services_for_host(inventory_hostname) }}"
tasks: tasks:
- name: Load secrets
ansible.builtin.import_tasks: tasks/load-secrets.yml
tags: always
- name: Get unused services - name: Get unused services
ansible.builtin.include_tasks: ansible.builtin.include_tasks:
file: tasks/get-unused.yml file: tasks/get-unused.yml

View file

@ -2,5 +2,17 @@
- name: Import tasks to template the site for the reverse proxy - name: Import tasks to template the site for the reverse proxy
ansible.builtin.include_tasks: "{{ tasks_dir }}/steps/template-site-config.yml" ansible.builtin.include_tasks: "{{ tasks_dir }}/steps/template-site-config.yml"
when: svc.domain is defined when: svc.domain is defined
- name: Import argus role to create service config
ansible.builtin.include_role:
name: argus
tasks_from: create-service.yml
apply:
delegate_to: "{{ all_services.argus.host }}"
vars:
argus_service_ver: "{{ ver }}"
argus_service_name: "{{ service_name }}"
when: ver is defined
- name: Import tasks to start the service - name: Import tasks to start the service
ansible.builtin.include_tasks: "{{ tasks_dir }}/steps/start-service.yml" ansible.builtin.include_tasks: "{{ tasks_dir }}/steps/start-service.yml"

View file

@ -31,6 +31,16 @@ services = {
database = false database = false
}, },
"argus" = {
host = "node002"
dns = [{
domain = "updates.serguzim.me"
vpn = true
}]
auth = false
database = false
}
"authentik" = { "authentik" = {
host = "node001" host = "node001"
dns = [{ dns = [{

View file

@ -1,4 +1,6 @@
--- ---
NEW_ROLE_NAME_version_NEW_ROLE_NAME: 0.0.1
NEW_ROLE_NAME_svc: NEW_ROLE_NAME_svc:
domain: "{{ all_services | service_get_domain(service_name) }}" domain: "{{ all_services | service_get_domain(service_name) }}"
port: 80 port: 80
@ -7,10 +9,21 @@ NEW_ROLE_NAME_env:
EXAMPLE: value EXAMPLE: value
NEW_ROLE_NAME_compose: NEW_ROLE_NAME_compose:
watchtower: update image: "NEW_ROLE_NAME/NEW_ROLE_NAME:{{ NEW_ROLE_NAME_version_NEW_ROLE_NAME }}"
image:
volumes: volumes:
- data:/data - data:/data
file: file:
volumes: volumes:
data: data:
NEW_ROLE_NAME_ver:
service:
NEW_ROLE_NAME_NEW_ROLE_NAME:
latest_version:
type: github
url: NEW_ROLE_NAME/NEW_ROLE_NAME
deployed_version:
version: "{{ NEW_ROLE_NAME_version_NEW_ROLE_NAME }}"
dashboard:
icon: https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/NEW_ROLE_NAME.webp
web_url: !unsafe https://github.com/NEW_ROLE_NAME/NEW_ROLE_NAME/releases/tag/{{ version }}