Add argus service for update management
This commit is contained in:
parent
89ced72d09
commit
d0f96ef6cd
5 changed files with 208 additions and 6 deletions
61
playbooks/roles/argus/defaults/main.yml
Normal file
61
playbooks/roles/argus/defaults/main.yml
Normal 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 }}
|
||||
6
playbooks/roles/argus/handlers/main.yml
Normal file
6
playbooks/roles/argus/handlers/main.yml
Normal 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
|
||||
15
playbooks/roles/argus/tasks/create-service.yml
Normal file
15
playbooks/roles/argus/tasks/create-service.yml
Normal 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
|
||||
32
playbooks/roles/argus/tasks/main.yml
Normal file
32
playbooks/roles/argus/tasks/main.yml
Normal 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"
|
||||
12
playbooks/roles/argus/tasks/merge-configs.yml
Normal file
12
playbooks/roles/argus/tasks/merge-configs.yml
Normal 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
|
||||
Loading…
Reference in a new issue