homelab/roles/wordpress/tasks/main.yml

29 lines
937 B
YAML

- name: Start MariaDB container
docker_container:
name: "{{ mariadb_name }}"
image: mariadb:{{ mariadb_version }}
restart_policy: always
volumes: mariadb:/var/lib/mysql
env:
MYSQL_RANDOM_ROOT_PASSWORD: "true"
MYSQL_DATABASE: "{{ wordpress_dbname }}"
MYSQL_USER: "{{ wordpress_dbuser }}"
MYSQL_PASSWORD: "{{ wordpress_dbpass }}"
- name: Start WordPress container
docker_container:
name: "{{ wordpress_name }}"
image: wordpress:{{ wordpress_version }}
restart_policy: always
volumes: wordpress:/var/www/html
labels:
traefik.http.routers.wordpress.rule: "Host(`{{ wordpress_domain }}`)"
traefik.enable: "true"
links:
- "{{ mariadb_name }}"
env:
WORDPRESS_DB_NAME: "{{ wordpress_dbname }}"
WORDPRESS_DB_USER: "{{ wordpress_dbuser }}"
WORDPRESS_DB_PASSWORD: "{{ wordpress_dbpass }}"
WORDPRESS_DB_HOST: "{{ mariadb_name }}"