4
0
forked from jakub/ansible
Files
ansible_fencl/update_homarr.yml
T
2026-06-29 12:24:51 +02:00

65 lines
1.8 KiB
YAML

# update_homarr.yml
- name: Update Homarr
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"
# Homarr settings
homarr_project: homarr
homarr_compose_filename: "docker-compose-homarr.yml"
homarr_service: homarr
homarr_port: 7575
tasks:
- name: Ensure remote compose directory exists
ansible.builtin.file:
path: "{{ compose_remote_base }}"
state: directory
mode: "0755"
- name: Upload Homarr compose file to remote host
ansible.builtin.copy:
src: "{{ compose_local_dir }}/{{ homarr_compose_filename }}"
dest: "{{ compose_remote_base }}/{{ homarr_compose_filename }}"
mode: "0644"
- name: Pull latest Homarr image
community.docker.docker_compose_v2:
project_name: "{{ homarr_project }}"
project_src: "{{ compose_remote_base }}"
files:
- "{{ homarr_compose_filename }}"
pull: always
- name: Recreate Homarr service
community.docker.docker_compose_v2:
project_name: "{{ homarr_project }}"
project_src: "{{ compose_remote_base }}"
files:
- "{{ homarr_compose_filename }}"
services:
- "{{ homarr_service }}"
state: present
recreate: always
- name: Wait for Homarr port
ansible.builtin.wait_for:
host: 127.0.0.1
port: "{{ homarr_port }}"
timeout: 60
- name: Check Homarr HTTP endpoint
ansible.builtin.uri:
url: "http://127.0.0.1:{{ homarr_port }}/"
status_code: 200
register: homarr_http
retries: 30
delay: 3
until: homarr_http.status == 200
changed_when: false