Added Stirling-PDF

This commit is contained in:
tanshu committed 2024-05-27 13:25:44 +05:30
1 parent ceb19235d5
commit 230a360ad7
7 files changed
+130

No files matched your search

@@ -0,0 +1,6 @@
---
# Handlers for Nginx role
- name: Reload Nginx
service:
name: nginx
state: reloaded
+24
View File
@@ -0,0 +1,24 @@
---
# Tasks for Nginx role
- name: Check if Nginx conf file exists
stat:
path: "/etc/nginx/sites-available/{{ http_conf }}"
register: status
- name: No need to reload Nginx
debug:
msg: "No need to reload Nginx as sites-available entries have already been created"
- name: Set Nginx conf file
when: status.stat.exists == false
template:
src: "files/nginx.conf.j2"
dest: "/etc/nginx/sites-available/{{ http_conf }}"
- name: Enable new site
when: status.stat.exists == false
file:
src: "/etc/nginx/sites-available/{{ http_conf }}"
dest: "/etc/nginx/sites-enabled/{{ http_conf }}"
state: link
notify: Reload Nginx
@@ -0,0 +1,49 @@
---
# Tasks for Stirling-PDF role
- name: Pull Stirling-PDF image
docker_image:
name: "{{ image }}"
source: pull
force_source: yes
- name: Ensure Stirling-PDF Directory exists
file:
path: "/var/lib/{{ host_directory }}"
state: directory
mode: 0755
- name: Ensure Directory for the tesseract ocr training data exists
file:
path: "/var/lib/{{ host_directory }}/training-data"
state: directory
mode: 0755
- name: Check if tesseract ocr training data exists
stat:
path: "/var/lib/{{ host_directory }}/training-data/eng.traineddata"
register: traineddata
- name: Download eng.traineddata
get_url:
url: "https://github.com/tesseract-ocr/tessdata/raw/main/eng.traineddata"
dest: "/var/lib/{{ host_directory }}/training-data/eng.traineddata"
mode: '0644'
when: not traineddata.stat.exists
- name: Create Stirling-PDF container
docker_container:
name: "{{ container }}"
image: "{{ image }}"
state: started
restart_policy: "unless-stopped"
env:
DOCKER_ENABLE_SECURITY: "false"
INSTALL_BOOK_AND_ADVANCED_HTML_OPS: "false"
LANGS: en_GB
published_ports:
- "127.0.0.1:{{ host_port }}:8080"
volumes:
- "/var/lib/{{ host_directory }}/training-data:/usr/share/tessdata"
- "/var/lib/{{ host_directory }}/extra-configs:/configs"
- "/var/lib/{{ host_directory }}/logs:/logs"
- "/var/lib/{{ host_directory }}/custom-files:/customFiles"