From ddfc1fd57445993aa1287df702f7093479190d84 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Fri, 13 Jan 2017 19:57:14 +0100 Subject: [PATCH] library/roles/sharelatex: Add the missing files. --- sharelatex/defaults/main.yml | 20 ++++++++++++++++++++ sharelatex/tasks/main.yml | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 sharelatex/defaults/main.yml create mode 100644 sharelatex/tasks/main.yml diff --git a/sharelatex/defaults/main.yml b/sharelatex/defaults/main.yml new file mode 100644 index 00000000..e2c801ad --- /dev/null +++ b/sharelatex/defaults/main.yml @@ -0,0 +1,20 @@ +--- +sharelatex_install: False +sharelatex_docker_compose: False +sharelatex_docker_image: 'sharelatex/sharelatex' +sharelatex_container_name: sharelatex +sharelatex_privileged: False +sharelatex_container_public_port: 5000 +sharelatex_container_local_port: 80 +sharelatex_behind_proxy: 'true' +sharelatex_local_mongodb: False +sharelatex_local_redis: False +sharelatex_local_nginx: False + +sharelatex_mongodb_url: 'mongodb://mongo/sharelatex' +sharelatex_redis_host: localhost +sharelatex_app_name: Our ShareLaTeX +sharelatex_site_url: 'http://localhost/sharelatex' +sharelatex_host_data_dir: '/srv/sharelatex_data' +sharelatex_container_data_dir: '/var/lib/sharelatex' + diff --git a/sharelatex/tasks/main.yml b/sharelatex/tasks/main.yml new file mode 100644 index 00000000..7a226bef --- /dev/null +++ b/sharelatex/tasks/main.yml @@ -0,0 +1,32 @@ +--- +- block: + - name: Create the sharelatex data dir on the host when the container runs as docker + file: dest={{ sharelatex_data_dir }} state=directory owner=docker group=docker + when: docker_run_as_docker_user + + - name: Create the sharelatex data dir on the host when the container runs as root + file: dest={{ sharelatex_data_dir }} state=directory + when: not docker_run_as_docker_user + + - name: Create the sharelatex directory into the docker s user home + file: dest={{ docker_user_home }}/sharelatex state=directory owner=docker group=docker + when: docker_run_as_docker_user + + - name: Install the docker env file when the container runs as docker + template: src=sharelatex-env.sh.j2 dest={{ docker_user_home }}/sharelatex/sharelatex-env.sh owner=docker group=docker + when: docker_run_as_docker_user + + - name: Install the docker env file when the container runs as root + template: src=sharelatex-env.sh.j2 dest=/opt/sharelatex-env.sh + when: not docker_run_as_docker_user + + - name: Start the Sharelatex docker container as docker user + command: docker run -v {{ sharelatex_host_data_dir }}:{{ sharelatex_container_data_dir }} -p {{ sharelatex_container_public_port }}:{{ sharelatex_container_local_port }} --name={{ sharelatex_container_name }} --env-file {{ docker_user_home }}/sharelatex/sharelatex-env.sh {{ sharelatex_docker_image }} + when: docker_run_as_docker_user + + - name: Start the Sharelatex docker container as root + command: docker run -v {{ sharelatex_host_data_dir }}:{{ sharelatex_container_data_dir }} -p {{ sharelatex_container_public_port }}:{{ sharelatex_container_local_port }} --name={{ sharelatex_container_name }} --env-file /opt/sharelatex-env.sh {{ sharelatex_docker_image }} + when: not docker_run_as_docker_user + + when: sharelatex_install + tags: [ 'docker', 'sharelatex' ]