Files
ansible/update_homarr.yml
martin.fencl 48b3f6059a edit homarr
2026-02-03 17:50:51 +01:00

59 lines
1.7 KiB
YAML

# update_homarr2.yml
- name: Update Homarr
hosts: pve2_vm
gather_facts: false
vars:
homarr_project: homarr
# Local path (controller / where Ansible runs)
homarr_compose_local: "{{ playbook_dir }}/docker-compose/docker-compose-homarr.yml"
# Remote path (target / where Docker runs)
homarr_compose_remote_dir: "/data/compose/homarr"
homarr_compose_remote: "{{ homarr_compose_remote_dir }}/docker-compose-homarr.yml"
homarr_service: homarr
homarr_port: 7575
tasks:
- name: Ensure remote compose directory exists
ansible.builtin.file:
path: "{{ homarr_compose_remote_dir }}"
state: directory
mode: "0755"
- name: Copy compose file from controller to remote host
ansible.builtin.copy:
src: "{{ homarr_compose_local }}"
dest: "{{ homarr_compose_remote }}"
mode: "0644"
- name: Pull latest Homarr image
community.docker.docker_compose_v2:
project_src: "{{ homarr_compose_remote_dir }}"
files:
- "{{ homarr_compose_remote | basename }}"
pull: always
- name: Recreate Homarr service
community.docker.docker_compose_v2:
project_src: "{{ homarr_compose_remote_dir }}"
files:
- "{{ homarr_compose_remote | basename }}"
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