Update to 2022-08-08 18:00

master
Daniel Berteaud 2 years ago
parent f13b48a771
commit a01479e9cb
  1. 14
      roles/docker_wordpress/defaults/main.yml
  2. 18
      roles/docker_wordpress/tasks/main.yml
  3. 26
      roles/docker_wordpress/templates/docker-compose.yml.j2

@ -7,16 +7,22 @@ wp_docker_name: wp_wordpress
wp_docker_root_dir: /opt/docker
# Default Wordpress image used from Docker HUB
wp_docker_image: wordpress-fpm:latest
wp_docker_wp_image: wordpress-fpm:latest
# Default PHPMyAdmin image used from Docker HUB
wp_docker_pma_image: phpmyadmin:latest
# Containers will automaticly restart Website at boot
wp_docker_restart: unless-stopped
# Default port of WP containers
wp_docker_port: 8080
# Default port of Wordpress containers
wp_docker_wp_port: 8080
# Default port of PHPMyAdmin containers
wp_docker_pma_port: 8180
# Default DB config
wp_docker_db_host: localhost
wp_docker_db_user: wp_wordpress
wp_docker_db_psw: wp_wordpress
wp_docker_db_pass: wp_wordpress
wp_docker_db_name: wp_wordpress

@ -1,5 +1,13 @@
---
- name: Create folders for each containers
with_items: "{{ wp_docker }}"
file:
path: "{{ wp_docker_root_dir }}/{{ item.wp_docker_name }}"
state: directory
owner: bin
group: wheel
mode: '0644'
- name: Deploy docker-compose YML file
with_items: "{{ wp_docker }}"
template:
@ -9,9 +17,13 @@
group: wheel
mode: '0644'
- name: Launch Wordpress containers
with_items: "{{ wp_docker }}"
command: "docker-compose up -d -f {{ wp_docker_root_dir }}/{{ item.wp_docker_name }}/docker-compose.yml"
# - name: Launch PhpMyAdmin containers
# with_items: "{{ wp_docker }}"
# command: "docker-compose up -d -f {{ wp_docker_root_dir }}/pma_{{ item.wp_docker_name }}/docker-compose.yml"
# - name: Launch Wordpress containers
# with_items: "{{ wp_docker }}"
# command: "docker-compose up -d -f {{ wp_docker_root_dir }}/{{ item.wp_docker_name }}/docker-compose.yml"
# - name: Send an welcome email message
# TODO

@ -2,18 +2,30 @@ version: '3.1'
services:
wordpress-fpm:
image: "{{ item.wp_docker_image }}"
image: "{{ item.wp_docker_wp_image }}"
restart: "{{ item.wp_docker_restart }}"
container_name: "{{ item.wp_docker_name }}"
ports: "{{ item.wp_docker_port}}"
ports: "{{ item.wp_docker_wp_port}}"
environment:
WORDPRESS_DB_HOST: "{{ item.wp_docker_db_host }}"
WORDPRESS_DB_USER: "{{ item.wp_docker_db_user }}"
WORDPRESS_DB_PASSWORD: "{{ item.wp_docker_db_psw }}"
WORDPRESS_DB_PASSWORD: "{{ item.wp_docker_db_pass }}"
WORDPRESS_DB_NAME: "{{ item.wp_docker_db_name }}"
volumes:
- /opt/wp/"{{ item.wp_docker_name }}"/html:/var/www/html
# conf PHP
# Backups
# cron
# email
# - conf PHP
# - Backups
# - cron
# - email
phpmyadmin:
image: "{{ item.wp_docker_pma_image }}"
restart: "{{ item.wp_docker_restart }}"
container_name: pma_"{{ item.wp_docker_name }}"
ports: "{{ item.wp_docker_pma_port}}"
environment:
- PMA_ARBITRARY=0
- PMA_HOST: "{{ item.wp_docker_db_host }}"
- PMA_ABSOLUTE_URI: db."{{ item.wp_docker_url }}"
volumes:
# -

Loading…
Cancel
Save