From c4d1abc39ec7fa15a31256ef63cf7ec002968215 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Wed, 10 Aug 2022 15:00:07 +0200 Subject: [PATCH] Update to 2022-08-10 15:00 --- roles/docker_wordpress/defaults/main.yml | 29 ++++++++++----------- roles/docker_wordpress/tasks/main.yml | 14 +++++----- roles/docker_wordpress/templates/docker-compose.j2 | 30 +++++++++++----------- 3 files changed, 36 insertions(+), 37 deletions(-) diff --git a/roles/docker_wordpress/defaults/main.yml b/roles/docker_wordpress/defaults/main.yml index 658435d..192793b 100644 --- a/roles/docker_wordpress/defaults/main.yml +++ b/roles/docker_wordpress/defaults/main.yml @@ -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 diff --git a/roles/docker_wordpress/tasks/main.yml b/roles/docker_wordpress/tasks/main.yml index 528bff6..4024f55 100644 --- a/roles/docker_wordpress/tasks/main.yml +++ b/roles/docker_wordpress/tasks/main.yml @@ -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 diff --git a/roles/docker_wordpress/templates/docker-compose.j2 b/roles/docker_wordpress/templates/docker-compose.j2 index d32a233..4468bcd 100644 --- a/roles/docker_wordpress/templates/docker-compose.j2 +++ b/roles/docker_wordpress/templates/docker-compose.j2 @@ -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