Add the Overleaf playbook

This commit is contained in:
tanshu committed 2026-10-18 21:35:52 +05:30
1 parent 250456e3fe
commit fc31504f57
7 files changed
+125

No files matched your search

+6
View File
@@ -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
+50
View File
@@ -0,0 +1,50 @@
---
# Tasks for Sharelatex role
- name: Pull Sharelatex image
docker_image:
name: "{{ sharelatex_image }}"
source: pull
force_source: yes
- name: Ensure Overleaf Directory exists
file:
path: "/var/lib/{{ host_directory }}"
state: directory
mode: 0755
- name: Create webserver container
docker_container:
name: "{{ sharelatex_container }}"
image: "{{ sharelatex_image }}"
state: started
restart_policy: "unless-stopped"
env:
# SHARELATEX_APP_NAME: Overleaf Community Edition
# SHARELATEX_MONGO_URL: mongodb://mongo/sharelatex
OVERLEAF_APP_NAME: Overleaf Community Edition
OVERLEAF_MONGO_URL: mongodb://mongo/sharelatex
# Same property, unfortunately with different names in
# different locations
OVERLEAF_REDIS_HOST: redis
REDIS_HOST: redis
ENABLED_LINKED_FILE_TYPES: 'project_file,project_output_file'
# Enables Thumbnail generation using ImageMagick
ENABLE_CONVERSIONS: 'true'
# Disables email confirmation requirement
EMAIL_CONFIRMATION_DISABLED: 'true'
# temporary fix for LuaLaTex compiles
# see https://github.com/overleaf/overleaf/issues/695
TEXMFVAR: /var/lib/sharelatex/tmp/texmf-var
links:
- "{{ mongo_container }}:mongo"
- "{{ redis_container }}:redis"
published_ports:
- "127.0.0.1:{{ host_port }}:80"
volumes:
- "/var/lib/{{ host_directory }}:/var/lib/overleaf"
# - "/var/lib/{{ host_directory }}:/var/lib/sharelatex"