Update to 2022-08-11 11:00

master
Daniel Berteaud 2 years ago
parent 572ee125ec
commit fe54a4e905
  1. 4
      roles/docker_wordpress/defaults/main.yml
  2. 49
      roles/docker_wordpress/tasks/main.yml
  3. 10
      roles/docker_wordpress/templates/docker-compose.j2

@ -7,7 +7,7 @@ wh_docker_root_dir: /opt/docker
# Default Wordpress configuration
wh_docker_wp_image: wordpress:6.0.1-php8.1-fpm
wh_docker_wp_port: 8080
wh_docker_wp_port: 8000
wh_docker_url: wordpress.org
wh_docker_admin: admin
wh_docker_pass: "S3cr3t."
@ -20,4 +20,4 @@ wh_docker_db_name: wordpress
# Default phpMyAdmin configuration
wh_docker_pma_image: phpmyadmin:latest
wh_docker_pma_port: 8180
wh_docker_pma_port: 9000

@ -1,20 +1,37 @@
---
- name: Create main folder for configuration files
- name: Create conf folder
file:
path: "{{ wh_docker_root_dir }}/conf"
state: directory
owner: bin
group: wheel
owner: root
group: root
mode: '0644'
- name: Create folders for each containers
- name: Create containers folders for conf
with_items: "{{ wh_docker }}"
file:
path: "{{ wh_docker_root_dir }}/conf/{{ item.wh_docker_name }}"
state: directory
owner: bin
group: wheel
owner: root
group: root
mode: '0644'
- name: Create wordpress folder
file:
path: "{{ wh_docker_root_dir }}/wordpress"
state: directory
owner: root
group: root
mode: '0644'
- name: Create containers folders for wordpress
with_items: "{{ wh_docker }}"
file:
path: "{{ wh_docker_root_dir }}/wordpress/{{ item.wh_docker_name }}"
state: directory
owner: root
group: root
mode: '0644'
- name: Deploy docker-compose YML file
@ -22,26 +39,18 @@
template:
src: docker-compose.j2
dest: "{{ wh_docker_root_dir }}/conf/{{ item.wh_docker_name }}/docker-compose.yml"
owner: bin
group: wheel
owner: root
group: root
mode: '0644'
- name: Create main folder for Wordpress files
file:
path: "{{ wh_docker_root_dir }}/wordpress"
state: directory
owner: bin
group: wheel
mode: '0644'
- name: Create custom PHP config file for each containers
with_items: "{{ wh_docker }}"
file:
path: "{{ wh_docker_root_dir }}/wordpress/{{ item.wh_docker_name }}/custom.ini"
state: touch
owner: bin
group: wheel
owner: root
group: root
mode: '0644'
- name: Create custom CRON config file for each containers
@ -49,8 +58,8 @@
file:
path: "{{ wh_docker_root_dir }}/wordpress/{{ item.wh_docker_name }}/custom_cron"
state: touch
owner: bin
group: wheel
owner: root
group: root
mode: '0644'
- name: Restart Docker

@ -5,16 +5,16 @@ services:
restart: unless-stopped
container_name: "wp_{{ item.wh_docker_name }}"
ports:
- "{{ item.wh_docker_wp_port}}":80
- {{ item.wh_docker_wp_port}}:80
environment:
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/wordpress/{{ item.wh_docker_name }}/html:/var/www/html # Wordpress
- /opt/wordpress/{{ item.wh_docker_name }}/custom.ini:/usr/local/etc/php/conf.d/custom.ini # Custom PHP configuration
- /opt/wordpress/{{ item.wh_docker_name }}/custom_cron:/usr/local/etc/php/conf.d/custom_cron # Custom CRON configuration
- {{ wh_docker_root_dir }}/wordpress/{{ item.wh_docker_name }}/html:/var/www/html # Wordpress files
- {{ wh_docker_root_dir }}/wordpress/{{ item.wh_docker_name }}/custom.ini:/usr/local/etc/php/conf.d/custom.ini # Custom PHP configuration
- {{ wh_docker_root_dir }}/wordpress/{{ item.wh_docker_name }}/custom_cron:/etc/cron.d/custom_cron # Custom CRON configuration
# - TODO : email
# - TODO : Backups
@ -23,7 +23,7 @@ services:
restart: unless-stopped
container_name: "pma_{{ item.wh_docker_name }}"
ports:
- "{{ item.wh_docker_pma_port}}":80
- {{ item.wh_docker_pma_port}}:80
environment:
PMA_ARBITRARY: 0
PMA_HOST: "{{ item.wh_docker_db_host }}"

Loading…
Cancel
Save