1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
fedihub-ansible/roles/matrix/tasks/static.yml
2020-10-09 16:50:47 +05:00

108 lines
3.4 KiB
YAML

---
- name: Install system packages for Matrix Static
apt:
name: golang
notify: Load, enable and restart Matrix Static
- name: Create Matrix Static system group
group:
name: '{{ matrix__static__group }}'
system: true
notify: Load, enable and restart Matrix Static
- name: Create Matrix Static system user
user:
name: '{{ matrix__static__user }}'
group: '{{ matrix__static__group }}'
system: true
create_home: false
notify: Load, enable and restart Matrix Static
- name: Create Matrix Static directories
file:
state: directory
path: '{{ item }}'
mode: 'u=rwx,g=rwx,o=rx'
owner: '{{ matrix__static__user }}'
group: '{{ matrix__static__group }}'
with_items:
- '{{ matrix__static__conf_dir }}'
- '{{ matrix__static__opt_dir }}'
- '{{ matrix__static__src_dir }}'
- '{{ matrix__static__bin_dir }}'
notify: Load, enable and restart Matrix Static
- name: Create Matrix Static config
template:
src: '../templates/static/config.json'
dest: '{{ matrix__static__conf_file }}'
mode: 'u=rw,g=rw,o='
owner: '{{ matrix__static__user }}'
group: '{{ matrix__static__group }}'
notify: Load, enable and restart Matrix Static
- name: Create Matrix Static systemd service
template:
src: '../templates/static/matrix-static.service'
dest: '{{ matrix__static__service_file }}'
mode: 'u=rw,g=rw,o=r'
owner: root
group: root
notify: Load, enable and restart Matrix Static
- name: Get Matrix Static source code
get_url:
url: '{{ matrix__static__url }}'
checksum: '{{ matrix__static__checksum }}'
dest: '{{ matrix__static__archive_file }}'
mode: 'u=rw,g=rw,o=r'
owner: '{{ matrix__static__user }}'
group: '{{ matrix__static__group }}'
- name: Extract Matrix Static source code
become_user: '{{ matrix__static__user }}'
unarchive:
remote_src: true
src: '{{ matrix__static__archive_file }}'
dest: '{{ matrix__static__src_dir }}'
creates: '{{ matrix__static__src_dir }}/README.md'
extra_opts:
- '--strip-components=1'
- name: Get Quicktemplate source code
become_user: '{{ matrix__static__user }}'
git:
repo: 'https://github.com/valyala/quicktemplate.git'
dest: '{{ matrix__static__opt_dir }}/go-quicktemplate'
version: '1a0f4e9691adbb86df52cb2dd9adafa6a28585a0'
- name: Install Quicktemplate
become_user: '{{ matrix__static__user }}'
command:
chdir: '{{ matrix__static__opt_dir }}/go-quicktemplate/qtc'
creates: '{{ matrix__static__opt_dir }}/go/bin/qtc'
cmd: 'go install .'
environment:
GOPATH: '{{ matrix__static__opt_dir }}/go'
GOCACHE: '{{ matrix__static__opt_dir }}/go-cache'
- name: Run Go executable qtc
become_user: '{{ matrix__static__user }}'
command:
chdir: '{{ matrix__static__src_dir }}'
creates: '{{ matrix__static__src_dir }}/templates/basepage.qtpl.go'
cmd: '{{ matrix__static__opt_dir }}/go/bin/qtc'
environment:
GOPATH: '{{ matrix__static__opt_dir }}/go'
GOCACHE: '{{ matrix__static__opt_dir }}/go-cache'
- name: Build Matrix Static source code
become_user: '{{ matrix__static__user }}'
command:
chdir: '{{ matrix__static__src_dir }}'
creates: '{{ matrix__static__bin_dir }}/matrix-static'
cmd: 'go build -o {{ matrix__static__bin_dir }} ./cmd/...'
environment:
GOPATH: '{{ matrix__static__opt_dir }}/go'
GOCACHE: '{{ matrix__static__opt_dir }}/go-cache'
notify: Load, enable and restart Matrix Static