ansible-nas/tasks/joomla.yml
2021-02-21 19:50:07 +00:00

47 lines
1.4 KiB
YAML

---
- name: Create Joomla Directories
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ joomla_data_directory }}"
- "{{ joomla_data_directory }}/db"
- name: MySQL Docker Container for Joomla
docker_container:
name: joomla_mysql
image: mysql:5.7
pull: true
volumes:
- "{{ joomla_data_directory }}/db:/var/lib/mysql"
env:
MYSQL_DATABASE: "joomla"
MYSQL_USER: "joomla"
MYSQL_ROOT_PASSWORD: "{{ joomla_database_password }}"
restart_policy: unless-stopped
memory: 1g
- name: Joomla Docker Container
docker_container:
name: joomla
image: joomla
pull: true
volumes:
- "{{ joomla_data_directory }}:/var/www/html:rw"
ports:
- "{{ joomla_port }}:80"
links:
- "joomla_mysql:mysql"
env:
JOOMLA_DB_HOST: "mysql"
JOOMLA_DB_USER: "root"
JOOMLA_DB_PASSWORD: "{{ joomla_database_password }}"
restart_policy: unless-stopped
memory: 1g
labels:
traefik.enable: "{{ joomla_available_externally }}"
traefik.http.routers.joomla.rule: "Host(`joomla.{{ ansible_nas_domain }}`)"
traefik.http.routers.joomla.tls.certresolver: "letsencrypt"
traefik.http.routers.joomla.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.joomla.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.joomla.loadbalancer.server.port: "80"