| --- |
| # timesheets tasks/main.yml |
| # |
| # SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org> |
| # SPDX-License-Identifier: Apache-2.0 |
| |
| - name: include OS-specific vars |
| include_vars: "{{ ansible_os_family }}.yml" |
| |
| - name: include OS-specific tasks |
| include_tasks: "{{ ansible_os_family }}.yml" |
| |
| - name: Create group for timesheets |
| group: |
| name: "{{ timesheets_groupname }}" |
| |
| - name: Create user for timesheets |
| user: |
| name: "{{ timesheets_username }}" |
| group: "{{ timesheets_groupname }}" |
| comment: "{{ timesheets_comment }}" |
| shell: "{{ timesheets_shell }}" |
| home: "{{ timesheets_dir }}" |
| create_home: no # yamllint disable-line rule:truthy |
| system: true |
| password_lock: true |
| |
| - name: Create directory for timesheetsdb |
| file: |
| path: "{{ timesheets_dir }}/db" |
| state: directory |
| owner: "{{ timesheets_username }}" |
| group: "{{ timesheets_groupname }}" |
| mode: "0755" |
| |
| - name: Obtain timesheetsdb code with git |
| become: true |
| become_user: "{{ timesheets_username }}" |
| git: |
| repo: "{{ timesheetsdb_repo }}" |
| dest: "{{ timesheets_dir }}/db" |
| version: "{{ timesheetsdb_version }}" |
| |
| - name: Create timesheetsdb configuration file |
| template: |
| src: "timesheetsdb_config.json.j2" |
| dest: "{{ timesheets_dir }}/db/timesheetsdb_config.json" |
| owner: "root" |
| group: "{{ timesheets_groupname }}" |
| mode: "0640" |
| notify: |
| - "restart-timesheetsdb" |
| |
| - name: Install timesheetsdb |
| become: true |
| become_user: "{{ timesheets_username }}" |
| command: |
| chdir: "{{ timesheets_dir }}/db" |
| cmd: "npm install" |
| creates: "{{ timesheets_dir }}/db/node_modules" |
| notify: |
| - "start-timesheetsdb" |
| |
| - name: Build timesheetsdb |
| become: true |
| become_user: "{{ timesheets_username }}" |
| command: |
| chdir: "{{ timesheets_dir }}/db" |
| cmd: "npm run build" |
| creates: "{{ timesheets_dir }}/db/dist" |
| notify: |
| - "start-timesheetsdb" |
| |
| - name: Create directory for timesheetsui |
| file: |
| path: "{{ timesheets_dir }}/ui" |
| state: directory |
| owner: "{{ timesheets_username }}" |
| group: "{{ timesheets_groupname }}" |
| mode: "0755" |
| |
| - name: Obtain timesheetsui code with git |
| become: true |
| become_user: "{{ timesheets_username }}" |
| git: |
| repo: "{{ timesheetsui_repo }}" |
| dest: "{{ timesheets_dir }}/ui" |
| version: "{{ timesheetsui_version }}" |
| |
| - name: Install timesheetsui |
| become: true |
| become_user: "{{ timesheets_username }}" |
| command: |
| chdir: "{{ timesheets_dir }}/ui" |
| cmd: "npm install" |
| creates: "{{ timesheets_dir }}/ui/node_modules" |
| |
| - name: Build timesheetsui dist |
| become: true |
| become_user: "{{ timesheets_username }}" |
| command: |
| chdir: "{{ timesheets_dir }}/ui" |
| cmd: "npm run-script ng build --prod" |
| creates: "{{ timesheets_dir }}/ui/dist" |