Zack Williams | 7099644 | 2020-10-01 22:09:49 -0700 | [diff] [blame] | 1 | --- |
| 2 | # timesheets tasks/main.yml |
Zack Williams | 7099644 | 2020-10-01 22:09:49 -0700 | [diff] [blame] | 3 | # 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 Williams | 7099644 | 2020-10-01 22:09:49 -0700 | [diff] [blame] | 42 | notify: |
| 43 | - "restart-timesheetsdb" |
| 44 | |
| 45 | - name: Install timesheetsdb |
| 46 | become: true |
| 47 | become_user: "{{ timesheets_username }}" |
Sean Condon | 4e86a8a | 2020-10-06 11:42:05 +0100 | [diff] [blame^] | 48 | npm: |
| 49 | path: "{{ timesheets_dir }}/db" |
| 50 | register: install_timesheetsdb |
Zack Williams | 7099644 | 2020-10-01 22:09:49 -0700 | [diff] [blame] | 51 | notify: |
Zack Williams | 952bc00 | 2020-10-04 09:45:59 -0700 | [diff] [blame] | 52 | - "restart-timesheetsdb" |
Zack Williams | 7099644 | 2020-10-01 22:09:49 -0700 | [diff] [blame] | 53 | |
| 54 | - name: Build timesheetsdb |
| 55 | become: true |
| 56 | become_user: "{{ timesheets_username }}" |
Sean Condon | 4e86a8a | 2020-10-06 11:42:05 +0100 | [diff] [blame^] | 57 | when: install_timesheetsdb.changed # noqa 503 |
Zack Williams | 7099644 | 2020-10-01 22:09:49 -0700 | [diff] [blame] | 58 | command: |
| 59 | chdir: "{{ timesheets_dir }}/db" |
| 60 | cmd: "npm run build" |
| 61 | creates: "{{ timesheets_dir }}/db/dist" |
| 62 | notify: |
Zack Williams | 952bc00 | 2020-10-04 09:45:59 -0700 | [diff] [blame] | 63 | - "restart-timesheetsdb" |
Zack Williams | 7099644 | 2020-10-01 22:09:49 -0700 | [diff] [blame] | 64 | |
| 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 Condon | 4e86a8a | 2020-10-06 11:42:05 +0100 | [diff] [blame^] | 84 | npm: |
| 85 | path: "{{ timesheets_dir }}/ui" |
| 86 | register: install_timesheetsui |
Zack Williams | 7099644 | 2020-10-01 22:09:49 -0700 | [diff] [blame] | 87 | |
| 88 | - name: Build timesheetsui dist |
| 89 | become: true |
| 90 | become_user: "{{ timesheets_username }}" |
Sean Condon | 4e86a8a | 2020-10-06 11:42:05 +0100 | [diff] [blame^] | 91 | when: install_timesheetsui.changed # noqa 503 |
Zack Williams | 7099644 | 2020-10-01 22:09:49 -0700 | [diff] [blame] | 92 | command: |
| 93 | chdir: "{{ timesheets_dir }}/ui" |
| 94 | cmd: "npm run-script ng build --prod" |
| 95 | creates: "{{ timesheets_dir }}/ui/dist" |