diff --git a/update_homarr.yml b/update_homarr.yml index 535eb0e..07627b2 100644 --- a/update_homarr.yml +++ b/update_homarr.yml @@ -6,23 +6,42 @@ vars: homarr_project: homarr - homarr_compose_file: "{{ playbook_dir }}/docker-compose/docker-compose-homarr.yml" + + # 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_file | dirname }}" + project_src: "{{ homarr_compose_remote_dir }}" files: - - "{{ homarr_compose_file | basename }}" + - "{{ homarr_compose_remote | basename }}" pull: always - name: Recreate Homarr service community.docker.docker_compose_v2: - project_src: "{{ homarr_compose_file | dirname }}" + project_src: "{{ homarr_compose_remote_dir }}" files: - - "{{ homarr_compose_file | basename }}" + - "{{ homarr_compose_remote | basename }}" services: - "{{ homarr_service }}" state: present