95 lines
2.9 KiB
YAML
95 lines
2.9 KiB
YAML
# code: language=ansible
|
|
|
|
---
|
|
- hosts: all
|
|
name: Heimdall landing page
|
|
tasks:
|
|
- name: Stop running containers
|
|
become_user: containers
|
|
become: true
|
|
ansible.builtin.systemd:
|
|
scope: user
|
|
name: container-{{ item }}.service
|
|
state: stopped
|
|
loop:
|
|
- heimdall
|
|
|
|
- name: Create podman volumes
|
|
containers.podman.podman_volume:
|
|
state: present
|
|
name: "{{ item }}"
|
|
become_user: containers
|
|
become: true
|
|
loop:
|
|
- heimdall-config
|
|
|
|
- name: Create podman networks
|
|
containers.podman.podman_network:
|
|
name: "{{ item }}"
|
|
recreate: false
|
|
state: "present"
|
|
become_user: containers
|
|
become: true
|
|
loop:
|
|
- traefik-heimdall
|
|
|
|
- name: Pull an image
|
|
become_user: containers
|
|
become: true
|
|
containers.podman.podman_image:
|
|
name: lscr.io/linuxserver/heimdall:latest
|
|
|
|
- name: Add a heimdall container
|
|
become_user: containers
|
|
become: true
|
|
containers.podman.podman_container:
|
|
name: heimdall
|
|
image: lscr.io/linuxserver/heimdall:latest
|
|
state: present
|
|
network:
|
|
- traefik-heimdall
|
|
volume:
|
|
- heimdall-config:/config:Z
|
|
label:
|
|
io.containers.autoupdate: "registry"
|
|
traefik.enable: "true"
|
|
|
|
traefik.http.routers.heimdall.entrypoints: "https"
|
|
traefik.http.routers.heimdall.rule: "Host(`{{ vault_domain }}`)"
|
|
traefik.http.routers.heimdall.tls: "true"
|
|
traefik.http.routers.heimdall.tls.certresolver: "wildcard"
|
|
traefik.http.routers.heimdall.service: "heimdall"
|
|
traefik.http.services.heimdall.loadbalancer.server.port: "80"
|
|
|
|
traefik.http.routers.heimdall-settings.entrypoints: "https"
|
|
traefik.http.routers.heimdall-settings.rule: "Host(`{{ vault_domain }}`) && Path(`/settings`)"
|
|
traefik.http.routers.heimdall-settings.tls: "true"
|
|
traefik.http.routers.heimdall-settings.tls.certresolver: "wildcard"
|
|
traefik.http.routers.heimdall-settings.service: "heimdall"
|
|
traefik.http.routers.heimdall-settings.middlewares: "heimdall-auth@docker"
|
|
traefik.http.services.heimdall-settings.loadbalancer.server.port: "80"
|
|
|
|
traefik.http.middlewares.heimdall-auth.basicauth.users: "{{ vault_heimdall_basic_auth }}"
|
|
|
|
traefik.docker.network: "traefik-heimdall"
|
|
env:
|
|
TZ: "Europe/Rome"
|
|
generate_systemd:
|
|
path: /home/containers/.config/systemd/user/
|
|
restart_policy: on-failure
|
|
time: 3600
|
|
names: true
|
|
new: true
|
|
|
|
- name: Start containers at boot
|
|
become_user: containers
|
|
become: true
|
|
ansible.builtin.systemd:
|
|
scope: user
|
|
name: container-{{ item }}.service
|
|
enabled: true
|
|
state: started
|
|
daemon_reload: true
|
|
loop:
|
|
- heimdall
|