From f4851a416b296e8bc3f0f9eae78a465668aff848 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Wed, 31 Oct 2018 22:26:36 +0100 Subject: [PATCH] fix user permission while upgrade --- tasks/install.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tasks/install.yml b/tasks/install.yml index 72670a6..968339e 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -39,17 +39,23 @@ file: path: "{{ unifi_base_dir }}/{{ unifi_version }}//UniFi/data" state: absent + become: True + become_user: "{{ unifi_user }}" - name: Stop service while restore process systemd: state: stopped enabled: yes name: unifi + become: True + become_user: root - name: Copy data folder from previews version synchronize: src: "{{ unifi_base_dir }}/{{ unifi_current_version }}/UniFi/data" dest: "{{ unifi_base_dir }}/{{ unifi_version }}/UniFi" + become: True + become_user: "{{ unifi_user }}" delegate_to: "{{ inventory_hostname }}" - name: Start service after restore process @@ -57,8 +63,8 @@ state: started enabled: yes name: unifi - become: True - become_user: "{{ unifi_user }}" + become: True + become_user: root when: - unifi_version is version(unifi_current_version, ">") - unifi_restore_after_upgrade