forked from jakub/ansible
edit homarr
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
- name: Update Homarr
|
- name: Update Homarr
|
||||||
hosts: pve2_vm
|
hosts: pve2_vm
|
||||||
gather_facts: false
|
gather_facts: false
|
||||||
|
become: true
|
||||||
|
become_method: sudo
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
homarr_project: homarr
|
|
||||||
homarr_compose_local: "{{ playbook_dir }}/docker-compose/docker-compose-homarr.yml"
|
homarr_compose_local: "{{ playbook_dir }}/docker-compose/docker-compose-homarr.yml"
|
||||||
homarr_compose_remote_dir: "/data/compose/homarr"
|
homarr_compose_remote_dir: "/data/compose/homarr"
|
||||||
homarr_compose_remote: "{{ homarr_compose_remote_dir }}/docker-compose-homarr.yml"
|
homarr_compose_remote: "{{ homarr_compose_remote_dir }}/docker-compose-homarr.yml"
|
||||||
@@ -11,19 +12,30 @@
|
|||||||
homarr_port: 7575
|
homarr_port: 7575
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
- name: Show effective user (debug)
|
||||||
|
ansible.builtin.command: id
|
||||||
|
register: whoami_result
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: Print effective user (debug)
|
||||||
|
ansible.builtin.debug:
|
||||||
|
var: whoami_result.stdout
|
||||||
|
|
||||||
- name: Ensure remote compose directory exists
|
- name: Ensure remote compose directory exists
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ homarr_compose_remote_dir }}"
|
path: "{{ homarr_compose_remote_dir }}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
become: true
|
|
||||||
|
- name: Test write access to remote dir (as become)
|
||||||
|
ansible.builtin.command: "sh -lc 'echo test > {{ homarr_compose_remote_dir }}/.ansible_write_test && rm -f {{ homarr_compose_remote_dir }}/.ansible_write_test'"
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
- name: Copy compose file from controller to remote host
|
- name: Copy compose file from controller to remote host
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: "{{ homarr_compose_local }}"
|
src: "{{ homarr_compose_local }}"
|
||||||
dest: "{{ homarr_compose_remote }}"
|
dest: "{{ homarr_compose_remote }}"
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Pull latest Homarr image
|
- name: Pull latest Homarr image
|
||||||
community.docker.docker_compose_v2:
|
community.docker.docker_compose_v2:
|
||||||
@@ -31,7 +43,6 @@
|
|||||||
files:
|
files:
|
||||||
- "{{ homarr_compose_remote | basename }}"
|
- "{{ homarr_compose_remote | basename }}"
|
||||||
pull: always
|
pull: always
|
||||||
become: true # pokud user nemá práva na docker socket, nech to tady
|
|
||||||
|
|
||||||
- name: Recreate Homarr service
|
- name: Recreate Homarr service
|
||||||
community.docker.docker_compose_v2:
|
community.docker.docker_compose_v2:
|
||||||
@@ -42,7 +53,6 @@
|
|||||||
- "{{ homarr_service }}"
|
- "{{ homarr_service }}"
|
||||||
state: present
|
state: present
|
||||||
recreate: always
|
recreate: always
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Wait for Homarr port
|
- name: Wait for Homarr port
|
||||||
ansible.builtin.wait_for:
|
ansible.builtin.wait_for:
|
||||||
|
|||||||
Reference in New Issue
Block a user