chef-recipes/containers/heimdall/tasks.yml

111 lines
3.3 KiB
YAML
Raw Permalink Normal View History

2023-02-15 13:03:22 +00:00
# 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
2023-08-01 08:59:37 +00:00
failed_when: false
2023-02-15 13:03:22 +00:00
- 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
2024-04-12 12:06:57 +00:00
requires: [container-traefik.service]
2023-02-15 13:03:22 +00:00
names: true
new: true
2023-04-20 15:14:24 +00:00
- name: Change start and stop timeout limits
become_user: containers
become: true
community.general.ini_file:
path: /home/containers/.config/systemd/user/container-heimdall.service
section: Service
option: "{{ item }}"
value: 3600
mode: "0664"
state: "present"
no_extra_spaces: true
loop:
- TimeoutStartSec
- TimeoutStopSec
2023-02-15 13:03:22 +00:00
- 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