parent
a01479e9cb
commit
64d2994388
5 changed files with 75 additions and 67 deletions
@ -1,28 +1,24 @@ |
||||
--- |
||||
|
||||
# Default name of WP containers and unique ID for this instance |
||||
wp_docker_name: wp_wordpress |
||||
|
||||
# Root dir of Docker |
||||
wp_docker_root_dir: /opt/docker |
||||
|
||||
# Default Wordpress image used from Docker HUB |
||||
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 Wordpress containers |
||||
wp_docker_wp_port: 8080 |
||||
|
||||
# Default port of PHPMyAdmin containers |
||||
wp_docker_pma_port: 8180 |
||||
# Default Docker configuration |
||||
wpdocker_name: wordpress |
||||
wpdocker_email: technique@iptek.fr |
||||
wpdocker_root_dir: /opt/docker |
||||
wpdocker_restart: unless-stopped |
||||
|
||||
# Default Wordpress configuration |
||||
wpdocker_wp_image: wordpress-fpm:latest |
||||
wpdocker_wp_port: 8080 |
||||
wpdocker_url: wp.iptek.fr |
||||
wpdocker_admin: iptek |
||||
wpdocker_pass: "S3cr3t." |
||||
|
||||
# Default DB config |
||||
wp_docker_db_host: localhost |
||||
wp_docker_db_user: wp_wordpress |
||||
wp_docker_db_pass: wp_wordpress |
||||
wp_docker_db_name: wp_wordpress |
||||
wpdocker_db_host: localhost |
||||
wpdocker_db_user: wordpress |
||||
wpdocker_db_pass: "S3cr3t." |
||||
wpdocker_db_name: wordpress |
||||
|
||||
# Default PHPMyAdmin configuration |
||||
wpdocker_pma_image: phpmyadmin:latest |
||||
wpdocker_pma_port: 8180 |
||||
|
@ -1,29 +1,35 @@ |
||||
--- |
||||
|
||||
- name: Create main folder for configuration files |
||||
file: |
||||
path: "{{ wpdocker_root_dir }}/conf" |
||||
state: directory |
||||
owner: bin |
||||
group: wheel |
||||
mode: '0644' |
||||
|
||||
- name: Create folders for each containers |
||||
with_items: "{{ wp_docker }}" |
||||
with_items: "{{ wpdocker }}" |
||||
file: |
||||
path: "{{ wp_docker_root_dir }}/{{ item.wp_docker_name }}" |
||||
path: "{{ wpdocker_root_dir }}/conf/{{ item.wpdocker_name }}" |
||||
state: directory |
||||
owner: bin |
||||
group: wheel |
||||
mode: '0644' |
||||
|
||||
- name: Deploy docker-compose YML file |
||||
with_items: "{{ wp_docker }}" |
||||
with_items: "{{ wpdocker }}" |
||||
template: |
||||
src: docker-compose.yml.j2 |
||||
dest: "{{ wp_docker_root_dir }}/{{ item.wp_docker_name }}/docker-compose.yml" |
||||
src: docker-compose.j2 |
||||
dest: "{{ wpdocker_root_dir }}/conf/{{ item.wpdocker_name }}/docker-compose.yml" |
||||
owner: bin |
||||
group: wheel |
||||
mode: '0644' |
||||
|
||||
# - 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: Launch containers |
||||
with_items: "{{ wpdocker }}" |
||||
command: "echo 'docker-compose -f {{ wpdocker_root_dir }}/conf/{{ item.wpdocker_name }}/docker-compose.yml up -d'" |
||||
# command: "docker-compose -f {{ wpdocker_root_dir }}/conf/{{ item.wpdocker_name }}/docker-compose.yml" up -d |
||||
|
||||
# - name: Send an welcome email message |
||||
# TODO |
||||
|
@ -0,0 +1,31 @@ |
||||
version: '3.1' |
||||
services: |
||||
wordpress-fpm: |
||||
image: "{{ item.wpdocker_wp_image }}" |
||||
restart: "{{ item.wpdocker_restart }}" |
||||
container_name: "wp_{{ item.wpdocker_name }}" |
||||
ports: |
||||
- "{{ item.wpdocker_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 }}" |
||||
volumes: |
||||
- /opt/wp/{{ item.wpdocker_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 }}" |
||||
ports: |
||||
- "{{ item.wpdocker_pma_port}}" |
||||
environment: |
||||
PMA_ARBITRARY: 0 |
||||
PMA_HOST: "{{ item.wpdocker_db_host }}" |
||||
PMA_ABSOLUTE_URI: "db.{{ item.wpdocker_url }}" |
||||
# volumes: |
||||
# - TODO : conf PMA |
@ -1,31 +0,0 @@ |
||||
version: '3.1' |
||||
|
||||
services: |
||||
wordpress-fpm: |
||||
image: "{{ item.wp_docker_wp_image }}" |
||||
restart: "{{ item.wp_docker_restart }}" |
||||
container_name: "{{ item.wp_docker_name }}" |
||||
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_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 |
||||
|
||||
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: |
||||
# - |
@ -0,0 +1,6 @@ |
||||
--- |
||||
|
||||
mysql_server_packages: |
||||
- "{{ (mysql_engine == 'mysql') | ternary('mysql-server','mariadb-server') }}" |
||||
- "{{ (mysql_engine == 'mysql') | ternary('mysql','mariadb') }}" |
||||
- python3-mysql |
Loading…
Reference in new issue