Skip to content

Commit

Permalink
Run tasks as KPI user
Browse files Browse the repository at this point in the history
  • Loading branch information
DavisRayM committed Dec 2, 2021
1 parent 19325fa commit 5594e3b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 0 additions & 2 deletions tasks/install-nvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 11 additions & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand All @@ -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 }}"
Expand All @@ -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 }}"
Expand Down

0 comments on commit 5594e3b

Please sign in to comment.