forked from jakub/ansible
feat: add Glance service and configuration files for deployment
This commit is contained in:
@@ -0,0 +1,22 @@
|
|||||||
|
# docker-compose-glance.yml
|
||||||
|
|
||||||
|
services:
|
||||||
|
glance:
|
||||||
|
container_name: glance
|
||||||
|
image: glanceapp/glance:latest
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
# Relative to project_src (~/.ansible-compose), so no username is hardcoded.
|
||||||
|
# The playbook creates this directory and uploads glance.yml into it.
|
||||||
|
# The image entrypoint is /app/glance --config /app/config/glance.yml,
|
||||||
|
# so the file must be named exactly glance.yml.
|
||||||
|
- ./glance/config:/app/config
|
||||||
|
environment:
|
||||||
|
# Used by the calendar widget and by relative timestamps
|
||||||
|
- TZ=Europe/Prague
|
||||||
|
# Optional: raises the GitHub API limit for the releases widget.
|
||||||
|
# Referenced from glance.yml as ${GITHUB_TOKEN}; inject it as a
|
||||||
|
# Semaphore secret instead of committing it here.
|
||||||
|
# - GITHUB_TOKEN=${GITHUB_TOKEN}
|
||||||
|
ports:
|
||||||
|
- '9445:8080'
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
# glance.yml - source of truth lives in git, deployed by update_glance.yml
|
||||||
|
|
||||||
|
pages:
|
||||||
|
- name: Home
|
||||||
|
# Optionally, if you only have a single page you can hide the desktop navigation for a cleaner look
|
||||||
|
# hide-desktop-navigation: true
|
||||||
|
columns:
|
||||||
|
- size: small
|
||||||
|
widgets:
|
||||||
|
- type: calendar
|
||||||
|
first-day-of-week: monday
|
||||||
|
|
||||||
|
- type: rss
|
||||||
|
limit: 10
|
||||||
|
collapse-after: 3
|
||||||
|
cache: 12h
|
||||||
|
feeds:
|
||||||
|
- url: https://www.root.cz/rss/clanky/
|
||||||
|
title: root clanky
|
||||||
|
limit: 6
|
||||||
|
- url: https://www.root.cz/rss/zpravicky/
|
||||||
|
title: root zpravy
|
||||||
|
limit: 6
|
||||||
|
|
||||||
|
- type: twitch-channels
|
||||||
|
channels:
|
||||||
|
- theprimeagen
|
||||||
|
- j_blow
|
||||||
|
- piratesoftware
|
||||||
|
- cohhcarnage
|
||||||
|
- christitustech
|
||||||
|
- EJ_SA
|
||||||
|
|
||||||
|
- size: full
|
||||||
|
widgets:
|
||||||
|
- type: group
|
||||||
|
widgets:
|
||||||
|
- type: hacker-news
|
||||||
|
- type: lobsters
|
||||||
|
|
||||||
|
- type: videos
|
||||||
|
channels:
|
||||||
|
- UCXuqSBlHAE6Xw-yeJA0Tunw # Linus Tech Tips
|
||||||
|
- UCR-DXc1voovS8nhAvccRZhg # Jeff Geerling
|
||||||
|
- UCsBjURrPoezykLs9EqgamOA # Fireship
|
||||||
|
- UCBJycsmduvYEL83R_U4JriQ # Marques Brownlee
|
||||||
|
- UCHnyfMqiRRG1u-2MsSQLbXA # Veritasium
|
||||||
|
|
||||||
|
- type: group
|
||||||
|
widgets:
|
||||||
|
- type: reddit
|
||||||
|
subreddit: technology
|
||||||
|
show-thumbnails: true
|
||||||
|
- type: reddit
|
||||||
|
subreddit: selfhosted
|
||||||
|
show-thumbnails: true
|
||||||
|
|
||||||
|
- size: small
|
||||||
|
widgets:
|
||||||
|
- type: weather
|
||||||
|
location: Ceske Budejovice, Czechia
|
||||||
|
units: metric # alternatively "imperial"
|
||||||
|
hour-format: 24h # alternatively "12h"
|
||||||
|
# Optionally hide the location from being displayed in the widget
|
||||||
|
# hide-location: true
|
||||||
|
|
||||||
|
- type: markets
|
||||||
|
markets:
|
||||||
|
- symbol: SPY
|
||||||
|
name: S&P 500
|
||||||
|
- symbol: BTC-USD
|
||||||
|
name: Bitcoin
|
||||||
|
- symbol: BTC-EUR
|
||||||
|
name: Bitcoin
|
||||||
|
- symbol: CZK=X
|
||||||
|
name: USD/CZK
|
||||||
|
|
||||||
|
- type: releases
|
||||||
|
cache: 1d
|
||||||
|
# Without authentication the GitHub API allows up to 60 requests per hour.
|
||||||
|
# Uncomment and pass GITHUB_TOKEN in as an environment variable to raise it.
|
||||||
|
# token: ${GITHUB_TOKEN}
|
||||||
|
repositories:
|
||||||
|
- trezor/trezor-firmware
|
||||||
|
- glanceapp/glance
|
||||||
|
- go-gitea/gitea
|
||||||
|
- immich-app/immich
|
||||||
|
- syncthing/syncthing
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
# update_glance.yml
|
||||||
|
|
||||||
|
- name: Update Glance
|
||||||
|
hosts: pve2_vm
|
||||||
|
gather_facts: false
|
||||||
|
|
||||||
|
vars:
|
||||||
|
# Compose sync (controller -> target)
|
||||||
|
compose_local_dir: "{{ playbook_dir }}/docker-compose"
|
||||||
|
compose_remote_base: "/home/{{ ansible_user }}/.ansible-compose"
|
||||||
|
|
||||||
|
# Glance settings
|
||||||
|
glance_project: glance
|
||||||
|
glance_compose_filename: "docker-compose-glance.yml"
|
||||||
|
glance_service: glance
|
||||||
|
glance_port: 9445
|
||||||
|
|
||||||
|
# Config delivery (git -> controller -> target).
|
||||||
|
# Must match the ./glance/config volume in the compose file.
|
||||||
|
glance_config_local: "{{ playbook_dir }}/files/glance/glance.yml"
|
||||||
|
glance_config_remote_dir: "{{ compose_remote_base }}/glance/config"
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Ensure remote compose directory exists
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ compose_remote_base }}"
|
||||||
|
state: directory
|
||||||
|
mode: "0755"
|
||||||
|
|
||||||
|
- name: Ensure Glance config directory exists
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ glance_config_remote_dir }}"
|
||||||
|
state: directory
|
||||||
|
mode: "0755"
|
||||||
|
|
||||||
|
- name: Upload Glance compose file to remote host
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ compose_local_dir }}/{{ glance_compose_filename }}"
|
||||||
|
dest: "{{ compose_remote_base }}/{{ glance_compose_filename }}"
|
||||||
|
mode: "0644"
|
||||||
|
|
||||||
|
- name: Upload Glance configuration
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ glance_config_local }}"
|
||||||
|
dest: "{{ glance_config_remote_dir }}/glance.yml"
|
||||||
|
mode: "0644"
|
||||||
|
|
||||||
|
- name: Pull latest Glance image
|
||||||
|
community.docker.docker_compose_v2:
|
||||||
|
project_name: "{{ glance_project }}"
|
||||||
|
project_src: "{{ compose_remote_base }}"
|
||||||
|
files:
|
||||||
|
- "{{ glance_compose_filename }}"
|
||||||
|
pull: always
|
||||||
|
|
||||||
|
- name: Recreate Glance service
|
||||||
|
community.docker.docker_compose_v2:
|
||||||
|
project_name: "{{ glance_project }}"
|
||||||
|
project_src: "{{ compose_remote_base }}"
|
||||||
|
files:
|
||||||
|
- "{{ glance_compose_filename }}"
|
||||||
|
services:
|
||||||
|
- "{{ glance_service }}"
|
||||||
|
state: present
|
||||||
|
recreate: always
|
||||||
|
|
||||||
|
- name: Wait for Glance port
|
||||||
|
ansible.builtin.wait_for:
|
||||||
|
host: 127.0.0.1
|
||||||
|
port: "{{ glance_port }}"
|
||||||
|
timeout: 60
|
||||||
|
|
||||||
|
- name: Check Glance HTTP endpoint
|
||||||
|
ansible.builtin.uri:
|
||||||
|
url: "http://127.0.0.1:{{ glance_port }}/"
|
||||||
|
status_code: 200
|
||||||
|
register: glance_http
|
||||||
|
retries: 30
|
||||||
|
delay: 3
|
||||||
|
until: glance_http.status == 200
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: Show Glance container logs on failed startup
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: "docker logs --tail 50 glance"
|
||||||
|
register: glance_logs
|
||||||
|
changed_when: false
|
||||||
|
when: glance_http is failed
|
||||||
Reference in New Issue
Block a user