blob: 73e55e5b68882279221c3d6b88f79182c5ef1798 [file] [log] [blame]
Zack Williams70996442020-10-01 22:09:49 -07001---
2# timesheets tasks/main.yml
Zack Williams70996442020-10-01 22:09:49 -07003# SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org>
4# SPDX-License-Identifier: Apache-2.0
5
6- name: include OS-specific vars
7 include_vars: "{{ ansible_os_family }}.yml"
8
9- name: include OS-specific tasks
10 include_tasks: "{{ ansible_os_family }}.yml"
11
12- name: Create group for timesheets
13 group:
14 name: "{{ timesheets_groupname }}"
15
16- name: Create user for timesheets
17 user:
18 name: "{{ timesheets_username }}"
19 group: "{{ timesheets_groupname }}"
20 comment: "{{ timesheets_comment }}"
21 shell: "{{ timesheets_shell }}"
22 home: "{{ timesheets_dir }}"
23 create_home: no # yamllint disable-line rule:truthy
24 system: true
25 password_lock: true
26
27- name: Create directory for timesheetsdb
28 file:
29 path: "{{ timesheets_dir }}/db"
30 state: directory
31 owner: "{{ timesheets_username }}"
32 group: "{{ timesheets_groupname }}"
33 mode: "0755"
34
35- name: Obtain timesheetsdb code with git
36 become: true
37 become_user: "{{ timesheets_username }}"
38 git:
39 repo: "{{ timesheetsdb_repo }}"
40 dest: "{{ timesheets_dir }}/db"
41 version: "{{ timesheetsdb_version }}"
Zack Williams70996442020-10-01 22:09:49 -070042 notify:
43 - "restart-timesheetsdb"
44
45- name: Install timesheetsdb
46 become: true
47 become_user: "{{ timesheets_username }}"
Sean Condon4e86a8a2020-10-06 11:42:05 +010048 npm:
49 path: "{{ timesheets_dir }}/db"
50 register: install_timesheetsdb
Zack Williams70996442020-10-01 22:09:49 -070051 notify:
Zack Williams952bc002020-10-04 09:45:59 -070052 - "restart-timesheetsdb"
Zack Williams70996442020-10-01 22:09:49 -070053
54- name: Build timesheetsdb
55 become: true
56 become_user: "{{ timesheets_username }}"
Sean Condon4e86a8a2020-10-06 11:42:05 +010057 when: install_timesheetsdb.changed # noqa 503
Zack Williams70996442020-10-01 22:09:49 -070058 command:
59 chdir: "{{ timesheets_dir }}/db"
60 cmd: "npm run build"
61 creates: "{{ timesheets_dir }}/db/dist"
62 notify:
Zack Williams952bc002020-10-04 09:45:59 -070063 - "restart-timesheetsdb"
Zack Williams70996442020-10-01 22:09:49 -070064
65- name: Create directory for timesheetsui
66 file:
67 path: "{{ timesheets_dir }}/ui"
68 state: directory
69 owner: "{{ timesheets_username }}"
70 group: "{{ timesheets_groupname }}"
71 mode: "0755"
72
73- name: Obtain timesheetsui code with git
74 become: true
75 become_user: "{{ timesheets_username }}"
76 git:
77 repo: "{{ timesheetsui_repo }}"
78 dest: "{{ timesheets_dir }}/ui"
79 version: "{{ timesheetsui_version }}"
80
81- name: Install timesheetsui
82 become: true
83 become_user: "{{ timesheets_username }}"
Sean Condon4e86a8a2020-10-06 11:42:05 +010084 npm:
85 path: "{{ timesheets_dir }}/ui"
86 register: install_timesheetsui
Zack Williams70996442020-10-01 22:09:49 -070087
88- name: Build timesheetsui dist
89 become: true
90 become_user: "{{ timesheets_username }}"
Sean Condon4e86a8a2020-10-06 11:42:05 +010091 when: install_timesheetsui.changed # noqa 503
Zack Williams70996442020-10-01 22:09:49 -070092 command:
93 chdir: "{{ timesheets_dir }}/ui"
94 cmd: "npm run-script ng build --prod"
95 creates: "{{ timesheets_dir }}/ui/dist"