Compare commits
22 commits
Author | SHA1 | Date | |
---|---|---|---|
743c8466e2 | |||
fb4f1ea49f | |||
25c890039c | |||
cae6199775 | |||
ea983c69db | |||
82e32ea3f5 | |||
e482e3102b | |||
8e62c6c371 | |||
cf4a97a492 | |||
ce7723730e | |||
535e7d5ce7 | |||
e56795b131 | |||
7f9360474f | |||
57ab7a845a | |||
257a973f14 | |||
c9e848697b | |||
da142ff236 | |||
c7198522b0 | |||
d2311fd11a | |||
3f38feed06 | |||
1039639a16 | |||
976f237c1f |
10 changed files with 91 additions and 76 deletions
6
.ansible-lint
Normal file
6
.ansible-lint
Normal file
|
@ -0,0 +1,6 @@
|
|||
skip_list:
|
||||
- fqcn-builtins
|
||||
- fqcn[action]
|
||||
- fqcn[action-core]
|
||||
- fqcn[canonical]
|
||||
- name[casing]
|
|
@ -1,9 +1,10 @@
|
|||
---
|
||||
|
||||
- hosts: libretranslate
|
||||
- name: 'Libretranslate playbook'
|
||||
hosts: 'libretranslate'
|
||||
roles:
|
||||
- nginx
|
||||
- libretranslate
|
||||
- 'nginx'
|
||||
- 'libretranslate'
|
||||
|
||||
vars_files:
|
||||
- ../defaults/main.yml
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
|
||||
- name: restart libretranslate
|
||||
- name: 'Restart libretranslate'
|
||||
systemd:
|
||||
name: libretranslate
|
||||
state: restarted
|
||||
name: 'libretranslate'
|
||||
state: 'restarted'
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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'
|
||||
|
|
Loading…
Reference in a new issue