Compare commits

...

22 commits
1.5.5 ... main

Author SHA1 Message Date
743c8466e2 Merge pull request '1.6.2' (#15) from staging into main
Reviewed-on: #15
Reviewed-by: meaz <meaz@no-reply@disroot.org>
2024-12-03 21:14:55 +01:00
fb4f1ea49f Merge branch 'main' into staging 2024-12-03 21:14:44 +01:00
25c890039c Merge pull request 'update to 1.6.2' (#14) from 1.6.2 into staging
Reviewed-on: #14
Reviewed-by: muppeth <muppeth@no-reply@disroot.org>
2024-11-24 08:06:03 +01:00
cae6199775
applied styling guide 2024-11-22 22:06:24 +01:00
ea983c69db
update to 1.6.2 2024-11-14 17:15:42 +01:00
82e32ea3f5 Merge pull request 'staging' (#13) from staging into main
Reviewed-on: #13
Reviewed-by: muppeth <muppeth@no-reply@disroot.org>
2024-10-08 21:49:15 +02:00
e482e3102b Merge branch 'main' into staging 2024-10-08 21:48:48 +02:00
8e62c6c371 Merge pull request 'update to 1.6.1' (#12) from 1.6.1 into staging
Reviewed-on: #12
Reviewed-by: muppeth <muppeth@no-reply@disroot.org>
2024-10-08 21:47:14 +02:00
cf4a97a492
update to 1.6.1 2024-10-05 09:39:47 +02:00
ce7723730e Merge pull request 'remove nginx_default_vhost_ssl var' (#11) from nginx_default_vhost_ssl into staging
Reviewed-on: #11
Reviewed-by: muppeth <muppeth@no-reply@disroot.org>
2024-08-21 22:08:41 +02:00
535e7d5ce7
remove nginx_default_vhost_ssl var 2024-08-10 11:27:58 +02:00
e56795b131 Merge pull request 'Update to 2024.3.1' (#10) from staging into main
Reviewed-on: #10
Reviewed-by: muppeth <muppeth@no-reply@disroot.org>
2024-07-09 20:14:39 +02:00
7f9360474f Merge pull request 'Update to v1.6.0' (#9) from v1.6.0 into staging
Reviewed-on: #9
Reviewed-by: muppeth <muppeth@no-reply@disroot.org>
2024-06-18 19:40:43 +02:00
57ab7a845a
update to 1.6.0 2024-06-09 11:02:07 +02:00
257a973f14 Merge branch 'staging' into main 2024-05-15 20:46:29 +02:00
c9e848697b Merge pull request 'Update to 1.5.7 (staging)' (#7) from 1.5.7 into staging
Reviewed-on: #7
Reviewed-by: muppeth <muppeth@no-reply@disroot.org>
2024-05-14 20:26:04 +02:00
da142ff236 Merge branch 'staging' into 1.5.7 2024-05-13 16:13:40 +02:00
c7198522b0
Update to 1.5.7 2024-05-13 16:11:05 +02:00
d2311fd11a Merge pull request '1.5.6' (#5) from 1.5.6 into main
Reviewed-on: #5
Reviewed-by: muppeth <muppeth@no-reply@disroot.org>
2024-03-19 19:46:21 +00:00
3f38feed06
added task to make sure home dire is owned by the user 2024-03-09 02:03:03 +01:00
1039639a16
restart libretranslate when updated 2024-03-08 18:05:50 +01:00
976f237c1f
Update to 1.5.6 2024-03-08 18:05:34 +01:00
10 changed files with 91 additions and 76 deletions

6
.ansible-lint Normal file
View file

@ -0,0 +1,6 @@
skip_list:
- fqcn-builtins
- fqcn[action]
- fqcn[action-core]
- fqcn[canonical]
- name[casing]

View file

@ -1,9 +1,10 @@
---
- hosts: libretranslate
- name: 'Libretranslate playbook'
hosts: 'libretranslate'
roles:
- nginx
- libretranslate
- 'nginx'
- 'libretranslate'
vars_files:
- ../defaults/main.yml

View file

@ -27,8 +27,6 @@ Then, when you first lauch libretranslate, it downloads all languages packages (
## Updating
You just need to update the `libretranslate_version` var and to run the role to update.
If you want to update language models, restart libretranslate service `service libretranslate restart`
## CHANGELOG
- **05.12.2023** - Add possibility to choose version and to update models

View file

@ -1,6 +1,6 @@
---
libretranslate_version: '1.5.5'
libretranslate_version: '1.6.2'
libretranslate_user: 'libretranslate'
libretranslate_group: 'libretranslate'
@ -21,29 +21,27 @@ libretranslate_environment:
## The following need to be uncommented and parameters to be set
- 'LT_HOST={{ libretranslate_host }}'
- 'LT_PORT=5000'
#- 'LT_CHAR_LIMIT='
#- 'LT_REQ_LIMIT='
#- 'LT_BATCH_LIMIT='
# - 'LT_CHAR_LIMIT='
# - 'LT_REQ_LIMIT='
# - 'LT_BATCH_LIMIT='
- 'LT_FRONTEND_LANGUAGE_SOURCE=auto'
- 'LT_FRONTEND_LANGUAGE_TARGET=locale'
- 'LT_FRONTEND_TIMEOUT=500'
#- 'LT_LOAD_ONLY='
# - 'LT_LOAD_ONLY='
- 'LT_THREADS=4'
#- 'LT_URL_PREFIX='
## The following just need to be uncommented, it doesn't need parameters
#- 'LT_DEBUG'
#- 'LT_SSL'
#- 'LT_SUGGESTIONS'
#- 'LT_DISABLE_FILES_TRANSLATION'
#- 'LT_DISABLE_WEB_UI'
#- 'LT_METRICS'
# - 'LT_URL_PREFIX='
## The following just need to be uncommented, it doesn't need parameters
# - 'LT_DEBUG'
# - 'LT_SSL'
# - 'LT_SUGGESTIONS'
# - 'LT_DISABLE_FILES_TRANSLATION'
# - 'LT_DISABLE_WEB_UI'
# - 'LT_METRICS'
- 'LT_UPDATE_MODELS'
#- 'LT_FORCE_UPDATE_MODELS' # uncomment this if you want to force the update of all languages.
# - 'LT_FORCE_UPDATE_MODELS' # uncomment this if you want to force the update of all languages.
#nginx vhosts
# nginx vhosts
nginx_default_vhost: 'libretranslate'
nginx_default_vhost_ssl: 'libretranslate'
nginx_gen_dh: 'false'
ssl_src_path: '/etc/letsencrypt/live'
@ -55,10 +53,10 @@ nginx_vhosts:
upstream_name: '127.0.0.1'
proto: 'http'
listen: '80'
#ssl_name: 'libretranslate.localhost'
# ssl_name: 'libretranslate.localhost'
secure_site: 'true'
secure_cookie: 'true'
#header_sameorigin: 'true'
# header_sameorigin: 'true'
use_error_log: 'true'
nginx_error_log_level: 'warn'
use_access_log: 'false'

View file

@ -1,6 +1,6 @@
---
- name: restart libretranslate
- name: 'Restart libretranslate'
systemd:
name: libretranslate
state: restarted
name: 'libretranslate'
state: 'restarted'

View file

@ -1,39 +1,41 @@
---
- name: "[INSTALL] - Get version installed"
shell: "{{ libretranslate_venv_path }}/bin/pip show libretranslate | grep Version: | cut -d' ' -f2"
become: yes
- name: '[INSTALL] - Get version installed'
command:
cmd: "{{ libretranslate_venv_path }}/bin/pip show libretranslate | grep Version: | cut -d' ' -f2"
become: true
become_user: '{{ libretranslate_user }}'
register: libretranslate_installed
register: 'libretranslate_installed'
ignore_errors: true # for first install, it doesn't exist...
- name: "[INSTALL] - add sh file"
- name: '[INSTALL] - add sh file'
template:
src: etc/profile.d/libretranslate.sh.j2
dest: "/etc/profile.d/libretranslate.sh"
src: 'etc/profile.d/libretranslate.sh.j2'
dest: '/etc/profile.d/libretranslate.sh'
mode: '0644'
- name: "[INSTALL] - Source the libretranslate.sh"
shell: "source /etc/profile.d/libretranslate.sh"
- name: '[INSTALL] - Source the libretranslate.sh'
shell:
cmd: 'source /etc/profile.d/libretranslate.sh'
args:
executable: /bin/bash
become: yes
executable: '/bin/bash'
become: true
become_user: '{{ libretranslate_user }}'
- name: '[INSTALL] - Create the initial virtualenv, install and update pip and setuptools'
pip:
name: "{{ libretranslate_pip_pkgs }}"
name: '{{ libretranslate_pip_pkgs }}'
virtualenv: '{{ libretranslate_venv_path }}/'
virtualenv_site_packages: yes
state: "latest"
become: yes
virtualenv_site_packages: true
become: true
become_user: '{{ libretranslate_user }}'
- name: '[INSTALL] - Install libretranslate'
pip:
name: libretranslate
name: 'libretranslate'
virtualenv: '{{ libretranslate_venv_path }}'
state: "latest"
become: yes
become: true
become_user: '{{ libretranslate_user }}'
when: libretranslate_installed.stdout != libretranslate_version
when: libretranslate_installed.stdout != libretranslate_version
notify:
- 'Restart libretranslate'

View file

@ -1,6 +1,6 @@
---
- name: '[INSTALLDEP] - Install Dependencies'
apt:
name: "{{ libretranslate_pkg }}"
update_cache: yes
- name: '[INSTALLDEP] - Install Dependencies'
apt:
name: '{{ libretranslate_pkg }}'
update_cache: true

View file

@ -1,14 +1,15 @@
---
- name: Add user
include_tasks: user.yml
- name: '[Main] - Add user'
include_tasks: 'user.yml'
- name: Install dependencies
include_tasks: installdeps.yml
- name: '[Main] - Install dependencies'
include_tasks: 'installdeps.yml'
- name: Install the app
include_tasks: installapp.yml
- name: '[Main] - Install the app'
include_tasks: 'installapp.yml'
- name: Deploy systemd
include_tasks: systemd.yml
tags: systemd
- name: '[Main] - Deploy systemd'
include_tasks: 'systemd.yml'
tags:
- 'systemd'

View file

@ -1,20 +1,22 @@
---
- name: "[SYSTEMD] - Deploy Systemd config"
- name: '[SYSTEMD] - Deploy Systemd config'
template:
src: etc/systemd/system/libretranslate.service.j2
dest: /etc/systemd/system/libretranslate.service
owner: root
group: root
mode: 0644
register: libretranslate
tags: systemd
src: 'etc/systemd/system/libretranslate.service.j2'
dest: '/etc/systemd/system/libretranslate.service'
owner: 'root'
group: 'root'
mode: '0644'
register: 'libretranslate'
tags:
- 'systemd'
- name: "[SYSTEMD] - Enable systemd"
- name: '[SYSTEMD] - Enable systemd'
service:
name: libretranslate
state: restarted
enabled: yes
name: 'libretranslate'
state: 'restarted'
enabled: true
daemon_reload: true
when: libretranslate.changed
tags: systemd
tags:
- 'systemd'

View file

@ -1,12 +1,19 @@
---
- name: "[USER] - Add group"
- name: '[USER] - Add group'
group:
name: '{{ libretranslate_group }}'
state: present
state: 'present'
- name: "[USER] - Add user libretranslate"
- name: '[USER] - Add user libretranslate'
user:
name: '{{ libretranslate_user }}'
shell: /bin/bash
shell: '/bin/bash'
group: '{{ libretranslate_group }}'
- name: '[USER] - Make sure right permissions are set to the user home dir'
file:
dest: '/home/{{ libretranslate_user }}'
owner: '{{ libretranslate_user }}'
group: '{{ libretranslate_group }}'
recurse: 'yes'