add first working version

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2022-11-26 19:47:39 +01:00
parent 700f9f22f7
commit 38e1137e06
No known key found for this signature in database
GPG Key ID: FE65CD384D5BF7B4
3 changed files with 52 additions and 0 deletions

13
defaults/main.yml Normal file
View File

@ -0,0 +1,13 @@
---
gamja_service_name: 'gamja-irc-webui'
gamja_service_path: '/data/{{ gamja_service_name }}'
gamja_web_path: '{{ gamja_service_path }}/dist'
gamja_git_repo: 'https://git.sr.ht/~emersion/gamja'
gamja_git_ref: '2d271685297431d64d4e42951300cd05536fcf6c'
gamja_config_url: 'wss://irc.example.org:8097'
gamja_config_auth: 'optional'
gamja_config_nick: 'Guest-*'
gamja_config_autoconnect: false
gamja_config_ping: 60

30
tasks/main.yml Normal file
View File

@ -0,0 +1,30 @@
---
- name: Clone repository
git:
repo: '{{ gamja_git_repo }}'
version: '{{ gamja_git_ref }}'
dest: '{{ gamja_service_path }}'
force: true
update: true
- name: Install Node.js
apt:
name:
- nginx-light
- nodejs
- npm
- name: Install dependencies
command: 'npm install'
args:
chdir: '{{ gamja_service_path }}'
- name: Build website
command: 'npm run build'
args:
chdir: '{{ gamja_service_path }}'
- name: Create config file
template:
src: 'config.json.j2'
dest: '{{ gamja_web_path }}/config.json'

9
templates/config.json.j2 Normal file
View File

@ -0,0 +1,9 @@
{
"server": {
"url": "{{ gamja_config_url | mandatory }}",
"auth": "{{ gamja_config_auth | mandatory }}",
"nick": "{{ gamja_config_nick | mandatory }}",
"autoconnect": {{ gamja_config_autoconnect | to_json }},
"ping": {{ gamja_config_autoconnect | int }}
}
}