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 | |
Zack Williams | e14f770 | 2020-10-22 19:57:55 -0700 | [diff] [blame] | 45 | - 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 Williams | 7099644 | 2020-10-01 22:09:49 -0700 | [diff] [blame] | 65 | - name: Install timesheetsdb |
| 66 | become: true |
| 67 | become_user: "{{ timesheets_username }}" |
Sean Condon | 4e86a8a | 2020-10-06 11:42:05 +0100 | [diff] [blame] | 68 | npm: |
| 69 | path: "{{ timesheets_dir }}/db" |
| 70 | register: install_timesheetsdb |
Zack Williams | 7099644 | 2020-10-01 22:09:49 -0700 | [diff] [blame] | 71 | notify: |
Zack Williams | 952bc00 | 2020-10-04 09:45:59 -0700 | [diff] [blame] | 72 | - "restart-timesheetsdb" |
Zack Williams | 7099644 | 2020-10-01 22:09:49 -0700 | [diff] [blame] | 73 | |
| 74 | - name: Build timesheetsdb |
| 75 | become: true |
| 76 | become_user: "{{ timesheets_username }}" |
Sean Condon | 4e86a8a | 2020-10-06 11:42:05 +0100 | [diff] [blame] | 77 | when: install_timesheetsdb.changed # noqa 503 |
Zack Williams | 7099644 | 2020-10-01 22:09:49 -0700 | [diff] [blame] | 78 | command: |
| 79 | chdir: "{{ timesheets_dir }}/db" |
| 80 | cmd: "npm run build" |
| 81 | creates: "{{ timesheets_dir }}/db/dist" |
| 82 | notify: |
Zack Williams | 952bc00 | 2020-10-04 09:45:59 -0700 | [diff] [blame] | 83 | - "restart-timesheetsdb" |
Zack Williams | 7099644 | 2020-10-01 22:09:49 -0700 | [diff] [blame] | 84 | |
| 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 Condon | 4e86a8a | 2020-10-06 11:42:05 +0100 | [diff] [blame] | 104 | npm: |
| 105 | path: "{{ timesheets_dir }}/ui" |
| 106 | register: install_timesheetsui |
Zack Williams | 7099644 | 2020-10-01 22:09:49 -0700 | [diff] [blame] | 107 | |
| 108 | - name: Build timesheetsui dist |
| 109 | become: true |
| 110 | become_user: "{{ timesheets_username }}" |
Sean Condon | 4e86a8a | 2020-10-06 11:42:05 +0100 | [diff] [blame] | 111 | when: install_timesheetsui.changed # noqa 503 |
Zack Williams | 7099644 | 2020-10-01 22:09:49 -0700 | [diff] [blame] | 112 | command: |
| 113 | chdir: "{{ timesheets_dir }}/ui" |
| 114 | cmd: "npm run-script ng build --prod" |
| 115 | creates: "{{ timesheets_dir }}/ui/dist" |