blob: 597d5f39b4b438ce6feb28c75d398c9cc9f0cba7 [file] [log] [blame]
Zack Williams70996442020-10-01 22:09:49 -07001---
2# timesheets tasks/main.yml
3#
4# SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org>
5# SPDX-License-Identifier: Apache-2.0
6
7- name: include OS-specific vars
8 include_vars: "{{ ansible_os_family }}.yml"
9
10- name: include OS-specific tasks
11 include_tasks: "{{ ansible_os_family }}.yml"
12
13- name: Create group for timesheets
14 group:
15 name: "{{ timesheets_groupname }}"
16
17- name: Create user for timesheets
18 user:
19 name: "{{ timesheets_username }}"
20 group: "{{ timesheets_groupname }}"
21 comment: "{{ timesheets_comment }}"
22 shell: "{{ timesheets_shell }}"
23 home: "{{ timesheets_dir }}"
24 create_home: no # yamllint disable-line rule:truthy
25 system: true
26 password_lock: true
27
28- name: Create directory for timesheetsdb
29 file:
30 path: "{{ timesheets_dir }}/db"
31 state: directory
32 owner: "{{ timesheets_username }}"
33 group: "{{ timesheets_groupname }}"
34 mode: "0755"
35
36- name: Obtain timesheetsdb code with git
37 become: true
38 become_user: "{{ timesheets_username }}"
39 git:
40 repo: "{{ timesheetsdb_repo }}"
41 dest: "{{ timesheets_dir }}/db"
42 version: "{{ timesheetsdb_version }}"
43
44- name: Create timesheetsdb configuration file
45 template:
46 src: "timesheetsdb_config.json.j2"
47 dest: "{{ timesheets_dir }}/db/timesheetsdb_config.json"
48 owner: "root"
49 group: "{{ timesheets_groupname }}"
50 mode: "0640"
51 notify:
52 - "restart-timesheetsdb"
53
54- name: Install timesheetsdb
55 become: true
56 become_user: "{{ timesheets_username }}"
57 command:
58 chdir: "{{ timesheets_dir }}/db"
59 cmd: "npm install"
60 creates: "{{ timesheets_dir }}/db/node_modules"
61 notify:
62 - "start-timesheetsdb"
63
64- name: Build timesheetsdb
65 become: true
66 become_user: "{{ timesheets_username }}"
67 command:
68 chdir: "{{ timesheets_dir }}/db"
69 cmd: "npm run build"
70 creates: "{{ timesheets_dir }}/db/dist"
71 notify:
72 - "start-timesheetsdb"
73
74- name: Create directory for timesheetsui
75 file:
76 path: "{{ timesheets_dir }}/ui"
77 state: directory
78 owner: "{{ timesheets_username }}"
79 group: "{{ timesheets_groupname }}"
80 mode: "0755"
81
82- name: Obtain timesheetsui code with git
83 become: true
84 become_user: "{{ timesheets_username }}"
85 git:
86 repo: "{{ timesheetsui_repo }}"
87 dest: "{{ timesheets_dir }}/ui"
88 version: "{{ timesheetsui_version }}"
89
90- name: Install timesheetsui
91 become: true
92 become_user: "{{ timesheets_username }}"
93 command:
94 chdir: "{{ timesheets_dir }}/ui"
95 cmd: "npm install"
96 creates: "{{ timesheets_dir }}/ui/node_modules"
97
98- name: Build timesheetsui dist
99 become: true
100 become_user: "{{ timesheets_username }}"
101 command:
102 chdir: "{{ timesheets_dir }}/ui"
103 cmd: "npm run-script ng build --prod"
104 creates: "{{ timesheets_dir }}/ui/dist"