blob: 73e55e5b68882279221c3d6b88f79182c5ef1798 [file] [log] [blame]
---
# 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 }}"
notify:
- "restart-timesheetsdb"
- name: Install timesheetsdb
become: true
become_user: "{{ timesheets_username }}"
npm:
path: "{{ timesheets_dir }}/db"
register: install_timesheetsdb
notify:
- "restart-timesheetsdb"
- name: Build timesheetsdb
become: true
become_user: "{{ timesheets_username }}"
when: install_timesheetsdb.changed # noqa 503
command:
chdir: "{{ timesheets_dir }}/db"
cmd: "npm run build"
creates: "{{ timesheets_dir }}/db/dist"
notify:
- "restart-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 }}"
npm:
path: "{{ timesheets_dir }}/ui"
register: install_timesheetsui
- name: Build timesheetsui dist
become: true
become_user: "{{ timesheets_username }}"
when: install_timesheetsui.changed # noqa 503
command:
chdir: "{{ timesheets_dir }}/ui"
cmd: "npm run-script ng build --prod"
creates: "{{ timesheets_dir }}/ui/dist"