diff --git a/tasks/install-nvm.yml b/tasks/install-nvm.yml index 934aacd..c7336e5 100644 --- a/tasks/install-nvm.yml +++ b/tasks/install-nvm.yml @@ -23,8 +23,6 @@ - name: Install npm dependencies in package.json # noqa 301 command: "{{ kpi_nvm_npm_path }} install" - become: true - become_user: "{{ kpi_system_user }}" args: chdir: "{{ kpi_checkout_path }}" environment: diff --git a/tasks/main.yml b/tasks/main.yml index 266bc7f..2b16380 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -11,16 +11,24 @@ - name: Install NVM and Global Node Packages include_tasks: install-nvm.yml + args: + apply: + become: true + become_user: "{{ kpi_system_user }}" tags: - nvm - name: Copy client-side config file + become: true + become_user: "{{ kpi_system_user }}" template: src: templates/kpi/config.es6.j2 dest: "{{ kpi_static_path }}/js/config.es6" mode: 0644 - name: Build client code # noqa 301 + become: true + become_user: "{{ kpi_system_user }}" command: "{{ kpi_nvm_npm_path }} run copy-fonts && {{ kpi_nvm_npm_path }} run build" args: chdir: "{{ kpi_checkout_path }}" @@ -31,6 +39,8 @@ - restart_service - name: Migrate and collect static files + become: true + become_user: "{{ kpi_system_user }}" django_manage: command: "{{ item }}" app_path: "{{ kpi_checkout_path }}" @@ -40,7 +50,7 @@ notify: - restart_service -- name: Change ownership of all the KPI files +- name: Ensure all KPI files are owned by the KPI user file: path: "{{ kpi_checkout_path }}" owner: "{{ kpi_system_user }}"