Zack Williams | 7099644 | 2020-10-01 22:09:49 -0700 | [diff] [blame] | 1 | --- |
| 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 }}" |
Zack Williams | 7099644 | 2020-10-01 22:09:49 -0700 | [diff] [blame] | 43 | notify: |
| 44 | - "restart-timesheetsdb" |
| 45 | |
| 46 | - name: Install timesheetsdb |
| 47 | become: true |
| 48 | become_user: "{{ timesheets_username }}" |
| 49 | command: |
| 50 | chdir: "{{ timesheets_dir }}/db" |
| 51 | cmd: "npm install" |
| 52 | creates: "{{ timesheets_dir }}/db/node_modules" |
| 53 | notify: |
Zack Williams | 952bc00 | 2020-10-04 09:45:59 -0700 | [diff] [blame^] | 54 | - "restart-timesheetsdb" |
Zack Williams | 7099644 | 2020-10-01 22:09:49 -0700 | [diff] [blame] | 55 | |
| 56 | - name: Build timesheetsdb |
| 57 | become: true |
| 58 | become_user: "{{ timesheets_username }}" |
| 59 | command: |
| 60 | chdir: "{{ timesheets_dir }}/db" |
| 61 | cmd: "npm run build" |
| 62 | creates: "{{ timesheets_dir }}/db/dist" |
| 63 | notify: |
Zack Williams | 952bc00 | 2020-10-04 09:45:59 -0700 | [diff] [blame^] | 64 | - "restart-timesheetsdb" |
Zack Williams | 7099644 | 2020-10-01 22:09:49 -0700 | [diff] [blame] | 65 | |
| 66 | - name: Create directory for timesheetsui |
| 67 | file: |
| 68 | path: "{{ timesheets_dir }}/ui" |
| 69 | state: directory |
| 70 | owner: "{{ timesheets_username }}" |
| 71 | group: "{{ timesheets_groupname }}" |
| 72 | mode: "0755" |
| 73 | |
| 74 | - name: Obtain timesheetsui code with git |
| 75 | become: true |
| 76 | become_user: "{{ timesheets_username }}" |
| 77 | git: |
| 78 | repo: "{{ timesheetsui_repo }}" |
| 79 | dest: "{{ timesheets_dir }}/ui" |
| 80 | version: "{{ timesheetsui_version }}" |
| 81 | |
| 82 | - name: Install timesheetsui |
| 83 | become: true |
| 84 | become_user: "{{ timesheets_username }}" |
| 85 | command: |
| 86 | chdir: "{{ timesheets_dir }}/ui" |
| 87 | cmd: "npm install" |
| 88 | creates: "{{ timesheets_dir }}/ui/node_modules" |
| 89 | |
| 90 | - name: Build timesheetsui dist |
| 91 | become: true |
| 92 | become_user: "{{ timesheets_username }}" |
| 93 | command: |
| 94 | chdir: "{{ timesheets_dir }}/ui" |
| 95 | cmd: "npm run-script ng build --prod" |
| 96 | creates: "{{ timesheets_dir }}/ui/dist" |