blob: 9700ccdb5ea7a5585eb472fd8b2a200f2ab47fcf [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
Zack Williamse14f7702020-10-22 19:57:55 -070045- name: Create ormconfig.json file from template
46 template:
47 src: "ormconfig.json.j2"
48 dest: "{{ timesheets_dir }}/db/ormconfig.json"
49 owner: "root"
50 group: "{{ timesheets_groupname }}"
51 mode: "0640"
52 notify:
53 - "restart-timesheetsdb"
54
55- name: Copy the the Docusign key
56 copy:
57 src: "docusignPrivate.key"
58 dest: "{{ timesheets_dir }}/db/docusignPrivate.key"
59 owner: "root"
60 group: "{{ timesheets_groupname }}"
61 mode: "0640"
62 notify:
63 - "restart-timesheetsdb"
64
Zack Williams70996442020-10-01 22:09:49 -070065- name: Install timesheetsdb
66 become: true
67 become_user: "{{ timesheets_username }}"
Sean Condon4e86a8a2020-10-06 11:42:05 +010068 npm:
69 path: "{{ timesheets_dir }}/db"
70 register: install_timesheetsdb
Zack Williams70996442020-10-01 22:09:49 -070071 notify:
Zack Williams952bc002020-10-04 09:45:59 -070072 - "restart-timesheetsdb"
Zack Williams70996442020-10-01 22:09:49 -070073
74- name: Build timesheetsdb
75 become: true
76 become_user: "{{ timesheets_username }}"
Sean Condon4e86a8a2020-10-06 11:42:05 +010077 when: install_timesheetsdb.changed # noqa 503
Zack Williams70996442020-10-01 22:09:49 -070078 command:
79 chdir: "{{ timesheets_dir }}/db"
80 cmd: "npm run build"
81 creates: "{{ timesheets_dir }}/db/dist"
82 notify:
Zack Williams952bc002020-10-04 09:45:59 -070083 - "restart-timesheetsdb"
Zack Williams70996442020-10-01 22:09:49 -070084
85- name: Create directory for timesheetsui
86 file:
87 path: "{{ timesheets_dir }}/ui"
88 state: directory
89 owner: "{{ timesheets_username }}"
90 group: "{{ timesheets_groupname }}"
91 mode: "0755"
92
93- name: Obtain timesheetsui code with git
94 become: true
95 become_user: "{{ timesheets_username }}"
96 git:
97 repo: "{{ timesheetsui_repo }}"
98 dest: "{{ timesheets_dir }}/ui"
99 version: "{{ timesheetsui_version }}"
100
101- name: Install timesheetsui
102 become: true
103 become_user: "{{ timesheets_username }}"
Sean Condon4e86a8a2020-10-06 11:42:05 +0100104 npm:
105 path: "{{ timesheets_dir }}/ui"
106 register: install_timesheetsui
Zack Williams70996442020-10-01 22:09:49 -0700107
108- name: Build timesheetsui dist
109 become: true
110 become_user: "{{ timesheets_username }}"
Sean Condon4e86a8a2020-10-06 11:42:05 +0100111 when: install_timesheetsui.changed # noqa 503
Zack Williams70996442020-10-01 22:09:49 -0700112 command:
113 chdir: "{{ timesheets_dir }}/ui"
114 cmd: "npm run-script ng build --prod"
115 creates: "{{ timesheets_dir }}/ui/dist"