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

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

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

Loading…
Cancel
Save