Update to 2022-08-10 15:00

master
Daniel Berteaud 2 years ago
parent e95a87ab86
commit c4d1abc39e
  1. 29
      roles/docker_wordpress/defaults/main.yml
  2. 14
      roles/docker_wordpress/tasks/main.yml
  3. 30
      roles/docker_wordpress/templates/docker-compose.j2

@ -1,24 +1,23 @@
---
# Default Docker configuration
wpdocker_name: wordpress
wpdocker_email: technique@iptek.fr
wpdocker_root_dir: /opt/docker
wpdocker_restart: unless-stopped
wh_docker_name: wordpress
wh_docker_email: technique@iptek.fr
wh_docker_root_dir: /opt/docker
# Default Wordpress configuration
wpdocker_wp_image: wordpress:6.0.1-php8.1-fpm
wpdocker_wp_port: 8080
wpdocker_url: wp.iptek.fr
wpdocker_admin: iptek
wpdocker_pass: "S3cr3t."
wh_docker_wp_image: wordpress:6.0.1-php8.1-fpm
wh_docker_wp_port: 8080
wh_docker_url: wp.iptek.fr
wh_docker_admin: iptek
wh_docker_pass: "S3cr3t."
# Default DB config
wpdocker_db_host: localhost
wpdocker_db_user: wordpress
wpdocker_db_pass: "S3cr3t."
wpdocker_db_name: wordpress
wh_docker_db_host: localhost
wh_docker_db_user: wordpress
wh_docker_db_pass: "S3cr3t."
wh_docker_db_name: wordpress
# Default phpMyAdmin configuration
wpdocker_pma_image: phpmyadmin:latest
wpdocker_pma_port: 8180
wh_docker_pma_image: phpmyadmin:latest
wh_docker_pma_port: 8180

@ -2,26 +2,26 @@
- name: Create main folder for configuration files
file:
path: "{{ wpdocker_root_dir }}/conf"
path: "{{ wh_docker_root_dir }}/conf"
state: directory
owner: bin
group: wheel
mode: '0644'
- name: Create folders for each containers
with_items: "{{ wpdocker }}"
with_items: "{{ wh_docker }}"
file:
path: "{{ wpdocker_root_dir }}/conf/{{ item.wpdocker_name }}"
path: "{{ wh_docker_root_dir }}/conf/{{ item.wh_docker_name }}"
state: directory
owner: bin
group: wheel
mode: '0644'
- name: Deploy docker-compose YML file
with_items: "{{ wpdocker }}"
with_items: "{{ wh_docker }}"
template:
src: docker-compose.j2
dest: "{{ wpdocker_root_dir }}/conf/{{ item.wpdocker_name }}/docker-compose.yml"
dest: "{{ wh_docker_root_dir }}/conf/{{ item.wh_docker_name }}/docker-compose.yml"
owner: bin
group: wheel
mode: '0644'
@ -30,8 +30,8 @@
service: name=docker state=restarted
- name: Launch containers
with_items: "{{ wpdocker }}"
command: "docker-compose -f {{ wpdocker_root_dir }}/conf/{{ item.wpdocker_name }}/docker-compose.yml up -d"
with_items: "{{ wh_docker }}"
command: "docker-compose -f {{ wh_docker_root_dir }}/conf/{{ item.wh_docker_name }}/docker-compose.yml up -d"
# - name: Send an welcome email message
# TODO

@ -1,32 +1,32 @@
version: '3.1'
services:
wordpress-fpm:
image: "{{ item.wpdocker_wp_image }}"
restart: "{{ item.wpdocker_restart }}"
container_name: "wp_{{ item.wpdocker_name }}"
image: "{{ item.wh_docker_wp_image }}"
restart: unless-stopped
container_name: "wp_{{ item.wh_docker_name }}"
ports:
- "{{ item.wpdocker_wp_port}}"
- "{{ item.wh_docker_wp_port}}"
environment:
WORDPRESS_DB_HOST: "{{ item.wpdocker_db_host }}"
WORDPRESS_DB_USER: "{{ item.wpdocker_db_user }}"
WORDPRESS_DB_PASSWORD: "{{ item.wpdocker_db_pass }}"
WORDPRESS_DB_NAME: "{{ item.wpdocker_db_name }}"
WORDPRESS_DB_HOST: "{{ item.wh_docker_db_host }}"
WORDPRESS_DB_USER: "{{ item.wh_docker_db_user }}"
WORDPRESS_DB_PASSWORD: "{{ item.wh_docker_db_pass }}"
WORDPRESS_DB_NAME: "{{ item.wh_docker_db_name }}"
volumes:
- /opt/wp/{{ item.wpdocker_name }}/html:/var/www/html
- /opt/wp/{{ item.wh_docker_name }}/html:/var/www/html
# - TODO : conf PHP
# - TODO : Backups
# - TODO : cron
# - TODO : email
phpmyadmin:
image: "{{ item.wpdocker_pma_image }}"
restart: "{{ item.wpdocker_restart }}"
container_name: "pma_{{ item.wpdocker_name }}"
image: "{{ item.wh_docker_pma_image }}"
restart: unless-stopped
container_name: "pma_{{ item.wh_docker_name }}"
ports:
- "{{ item.wpdocker_pma_port}}"
- "{{ item.wh_docker_pma_port}}"
environment:
PMA_ARBITRARY: 0
PMA_HOST: "{{ item.wpdocker_db_host }}"
PMA_ABSOLUTE_URI: "db.{{ item.wpdocker_url }}"
PMA_HOST: "{{ item.wh_docker_db_host }}"
PMA_ABSOLUTE_URI: "db.{{ item.wh_docker_url }}"
# volumes:
# - TODO : conf PMA

Loading…
Cancel
Save