From 3b78cc1604ffa6291b9309f79c5b9ec89acb868f Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Thu, 18 Jan 2024 20:54:20 +0100 Subject: [PATCH] Implemented draft for moddle --- roles/docker-moodle/tasks/main.yml | 12 +++++++++ .../templates/docker-compose.yml.j2 | 27 +++++++++++++++++++ roles/docker-moodle/vars/main.yml | 4 +++ 3 files changed, 43 insertions(+) create mode 100644 roles/docker-moodle/tasks/main.yml create mode 100644 roles/docker-moodle/templates/docker-compose.yml.j2 create mode 100644 roles/docker-moodle/vars/main.yml diff --git a/roles/docker-moodle/tasks/main.yml b/roles/docker-moodle/tasks/main.yml new file mode 100644 index 00000000..0b92f7c5 --- /dev/null +++ b/roles/docker-moodle/tasks/main.yml @@ -0,0 +1,12 @@ +--- +- name: "include docker-compose-database.yml" + include_tasks: docker-compose-database.yml + +- name: "include tasks nginx-docker-proxy-domain.yml" + include_tasks: nginx-docker-proxy-domain.yml + +- name: add docker-compose.yml + template: + src: "docker-compose.yml.j2" + dest: "{{docker_compose_instance_directory}}docker-compose.yml" + notify: docker compose project setup diff --git a/roles/docker-moodle/templates/docker-compose.yml.j2 b/roles/docker-moodle/templates/docker-compose.yml.j2 new file mode 100644 index 00000000..f5a99fb9 --- /dev/null +++ b/roles/docker-moodle/templates/docker-compose.yml.j2 @@ -0,0 +1,27 @@ +services: + +{% include 'templates/docker-service-' + database_type + '.yml.j2' %} + moodle: + image: docker.io/bitnami/moodle:latest + ports: + - '80:8080' + - '443:8443' + environment: + - MOODLE_DATABASE_HOST={{database_host}} + - MOODLE_DATABASE_PORT_NUMBER=3306 + - MOODLE_DATABASE_USER={{database_username}} + - MOODLE_DATABASE_NAME={{database_name}} + - ALLOW_EMPTY_PASSWORD=no + volumes: + - 'moodle:/bitnami/moodle' + - 'data:/bitnami/moodledata' +{% include 'templates/docker-container-depends-on-just-database.yml.j2' %} +{% include 'templates/docker-container-networks.yml.j2' %} + + +{% include 'templates/docker-compose-volumes.yml.j2' %} + moodle: + data: + +{% include 'templates/docker-compose-networks.yml.j2' %} + \ No newline at end of file diff --git a/roles/docker-moodle/vars/main.yml b/roles/docker-moodle/vars/main.yml new file mode 100644 index 00000000..a030f491 --- /dev/null +++ b/roles/docker-moodle/vars/main.yml @@ -0,0 +1,4 @@ +--- +docker_compose_project_name: "moodle" +database_password: "{{moodle_database_password}}" +database_type: "mariadb" \ No newline at end of file