Push daskboard playbook
This commit is contained in:
@@ -15,9 +15,10 @@ vault_aws_access_key_id: !vault |
|
||||
62613863303235336335643531313464373666333730326264376561393739663539
|
||||
vault_aws_secret_access_key: !vault |
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
61663563303730666436313566656238336333643439373132393634633731633866643432656334
|
||||
3930336332633734633734666564366235633630653635620a623239333661396562383864373530
|
||||
65393533626537313131353639323765333232396665303938323565653163396236306664326166
|
||||
3730666339643962390a313065616663336639373337663536623837633330393733343032636139
|
||||
38623639346563323364326532303064636233653733373761663364353436353231306131343834
|
||||
3763393666323133353565396633336131373566353466373634
|
||||
64653230353833313938316264303462373464643832333336343962653136646531303861376266
|
||||
3136626564333233343038373435306336366637366461340a333934306630626465346362326131
|
||||
35303265363633323835373862316564303332396636383131313732316131353239353538343364
|
||||
3366343036353134310a353939643463373430623735373033316461316430336263646239386332
|
||||
37343263633139653865666239393038663164343431623837336666646265383939376563613262
|
||||
3563653065386264303063353162633730623335376138323936
|
||||
kuma_password:
|
||||
119
playbooks/setup-dashboard.yml
Normal file
119
playbooks/setup-dashboard.yml
Normal file
@@ -0,0 +1,119 @@
|
||||
# setup-dashboard.yml
|
||||
# Deploys AutoKuma as its own compose project (separate from /apps/docker)
|
||||
# Required vault var (add to playbooks/vault.yaml):
|
||||
# kuma_password
|
||||
# Optional overrides (inventory / group_vars):
|
||||
# kuma_url (default http://192.168.0.60:3001)
|
||||
# kuma_username (default jester)
|
||||
|
||||
- name: Set AutoKuma defaults
|
||||
ansible.builtin.set_fact:
|
||||
autokuma_dir: /apps/autokuma
|
||||
autokuma_data_dir: /apps/data/autokuma
|
||||
autokuma_kuma_url: "{{ kuma_url | default('http://dashboard.netbird.cloud:3001') }}"
|
||||
autokuma_kuma_user: "{{ kuma_username | default('jester') }}"
|
||||
|
||||
- name: Fail early if the Kuma password is not defined
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- kuma_password is defined
|
||||
- kuma_password | length > 0
|
||||
fail_msg: "kuma_password is missing - add it to playbooks/vault.yaml (ansible-vault edit)."
|
||||
no_log: true
|
||||
|
||||
- name: Create AutoKuma compose directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ autokuma_dir }}"
|
||||
state: directory
|
||||
owner: docker
|
||||
group: docker
|
||||
mode: '0755'
|
||||
|
||||
# Lives under /apps/data so the existing restic backup covers it. AutoKuma
|
||||
# tracks the monitors it created in here; losing it can cause duplicates.
|
||||
- name: Create AutoKuma data directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ autokuma_data_dir }}"
|
||||
state: directory
|
||||
owner: docker
|
||||
group: docker
|
||||
mode: '0755'
|
||||
|
||||
- name: Write AutoKuma credentials (.env)
|
||||
ansible.builtin.copy:
|
||||
dest: "{{ autokuma_dir }}/.env"
|
||||
content: |
|
||||
AUTOKUMA__KUMA__USERNAME={{ autokuma_kuma_user }}
|
||||
AUTOKUMA__KUMA__PASSWORD={{ kuma_password }}
|
||||
owner: docker
|
||||
group: docker
|
||||
mode: '0600'
|
||||
no_log: true
|
||||
register: autokuma_env
|
||||
|
||||
# Image tag matters: the central Kuma runs v1 (louislam/uptime-kuma:1), so
|
||||
# use the v1 build. ":latest"/":master" target Kuma v2 and won't match.
|
||||
- name: Write AutoKuma docker-compose.yml
|
||||
ansible.builtin.copy:
|
||||
dest: "{{ autokuma_dir }}/docker-compose.yml"
|
||||
content: |
|
||||
services:
|
||||
autokuma:
|
||||
image: ghcr.io/bigboot/autokuma:uptime-kuma-v1-latest
|
||||
container_name: autokuma
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
AUTOKUMA__KUMA__URL: "{{ autokuma_kuma_url }}"
|
||||
AUTOKUMA__TAG_NAME: AutoKuma
|
||||
AUTOKUMA__DOCKER__HOSTS: unix:///var/run/docker.sock
|
||||
# run-backups.yml stops the app stack nightly; wait before
|
||||
# deleting monitors whose containers briefly disappear.
|
||||
AUTOKUMA__DELETE_GRACE_PERIOD: "900"
|
||||
AUTOKUMA__DEFAULT_SETTINGS: |-
|
||||
*.max_retries: 3
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- {{ autokuma_data_dir }}:/data
|
||||
owner: docker
|
||||
group: docker
|
||||
mode: '0644'
|
||||
register: autokuma_compose
|
||||
|
||||
- name: Setup AutoKuma Service
|
||||
ansible.builtin.copy:
|
||||
dest: /etc/systemd/system/autokuma.service
|
||||
content: |
|
||||
[Unit]
|
||||
Description=AutoKuma Service
|
||||
After=network.target docker.service
|
||||
Requires=docker.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
User=docker
|
||||
WorkingDirectory={{ autokuma_dir }}
|
||||
ExecStart=/usr/bin/docker compose -f docker-compose.yml up -d
|
||||
ExecStop=/usr/bin/docker compose -f docker-compose.yml stop
|
||||
TimeoutStartSec=0
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
register: autokuma_unit
|
||||
|
||||
- name: Reload systemd daemon
|
||||
ansible.builtin.systemd:
|
||||
daemon_reload: true
|
||||
|
||||
# "restarted" re-runs `compose up -d`, which recreates the container when
|
||||
# the compose file or .env changed; otherwise just make sure it's running.
|
||||
- name: Start AutoKuma Service
|
||||
ansible.builtin.systemd:
|
||||
name: autokuma
|
||||
state: "{{ 'restarted' if (autokuma_env is changed or autokuma_compose is changed or autokuma_unit is changed) else 'started' }}"
|
||||
enabled: true
|
||||
@@ -25,6 +25,9 @@
|
||||
- name: Setup-restic.yml - setup restic
|
||||
ansible.builtin.import_tasks: ./setup-restic.yml
|
||||
|
||||
- name: Setup-Dashboard.yml - setup restic
|
||||
ansible.builtin.import_tasks: ./setup-dashboard.yml
|
||||
|
||||
- name: Check if /apps/docker exists
|
||||
ansible.builtin.stat:
|
||||
path: "/apps/docker"
|
||||
|
||||
Reference in New Issue
Block a user