Conform WordPress role to Traefik
This commit is contained in:
parent
cb6b24f1a8
commit
d068d7fcb7
23
dev/host_vars/wordpress.yml
Normal file
23
dev/host_vars/wordpress.yml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# base
|
||||||
|
allow_reboot: false
|
||||||
|
manage_network: false
|
||||||
|
|
||||||
|
# docker
|
||||||
|
docker_users:
|
||||||
|
- vagrant
|
||||||
|
|
||||||
|
# traefik
|
||||||
|
traefik_version: latest
|
||||||
|
traefik_dashboard: true
|
||||||
|
traefik_domain: traefik.vm.krislamo.org
|
||||||
|
traefik_auth: admin:$apr1$T1l.BCFz$Jyg8msXYEAUi3LLH39I9d1 # admin:admin
|
||||||
|
#traefik_acme_email: realemail@example.com # Let's Encrypt settings
|
||||||
|
#traefik_production: true
|
||||||
|
|
||||||
|
# container settings
|
||||||
|
wordpress_version: latest
|
||||||
|
wordpress_domain: wordpress.vm.krislamo.org
|
||||||
|
|
||||||
|
# database settings
|
||||||
|
wordpress_dbversion: latest
|
||||||
|
wordpress_dbpass: password
|
10
dev/wordpress.yml
Normal file
10
dev/wordpress.yml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
- name: Install WordPress server (docker)
|
||||||
|
hosts: all
|
||||||
|
become: true
|
||||||
|
vars_files:
|
||||||
|
- host_vars/wordpress.yml
|
||||||
|
roles:
|
||||||
|
- base
|
||||||
|
- docker
|
||||||
|
- traefik
|
||||||
|
- wordpress
|
@ -1,6 +1,12 @@
|
|||||||
mariadb_name: mariadb
|
# container names
|
||||||
mariadb_version: latest
|
wordpress_container: wordpress
|
||||||
|
wordpress_dbcontainer: "{{ wordpress_container }}-db"
|
||||||
|
|
||||||
wordpress_version: latest
|
# database settings
|
||||||
wordpress_dbname: wordpress
|
wordpress_dbname: "{{ wordpress_container }}"
|
||||||
wordpress_dbuser: wordpress
|
wordpress_dbuser: "{{ wordpress_dbname }}"
|
||||||
|
|
||||||
|
# host mounts
|
||||||
|
wordpress_root: "/opt/wordpress"
|
||||||
|
wordpress_docroot: "{{ wordpress_root }}/public_html"
|
||||||
|
wordpress_dbroot: "{{ wordpress_root }}/database"
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
- name: Start MariaDB container
|
- name: Start WordPress database container
|
||||||
docker_container:
|
docker_container:
|
||||||
name: "{{ mariadb_name }}"
|
name: "{{ wordpress_dbcontainer }}"
|
||||||
image: mariadb:{{ mariadb_version }}
|
image: mariadb:{{ wordpress_dbversion }}
|
||||||
restart_policy: always
|
restart_policy: always
|
||||||
volumes: mariadb:/var/lib/mysql
|
volumes: "{{ wordpress_dbroot }}:/var/lib/mysql"
|
||||||
env:
|
env:
|
||||||
MYSQL_RANDOM_ROOT_PASSWORD: "true"
|
MYSQL_RANDOM_ROOT_PASSWORD: "true"
|
||||||
MYSQL_DATABASE: "{{ wordpress_dbname }}"
|
MYSQL_DATABASE: "{{ wordpress_dbname }}"
|
||||||
@ -12,17 +12,22 @@
|
|||||||
|
|
||||||
- name: Start WordPress container
|
- name: Start WordPress container
|
||||||
docker_container:
|
docker_container:
|
||||||
name: "{{ wordpress_name }}"
|
name: "{{ wordpress_container }}"
|
||||||
image: wordpress:{{ wordpress_version }}
|
image: wordpress:{{ wordpress_version }}
|
||||||
restart_policy: always
|
restart_policy: always
|
||||||
volumes: wordpress:/var/www/html
|
volumes:
|
||||||
|
- "{{ wordpress_docroot }}:/var/www/html"
|
||||||
labels:
|
labels:
|
||||||
traefik.http.routers.wordpress.rule: "Host(`{{ wordpress_domain }}`)"
|
traefik.http.routers.wordpress.rule: "Host(`{{ wordpress_domain }}`)"
|
||||||
|
traefik.http.routers.wordpress.entrypoints: websecure
|
||||||
|
traefik.http.routers.wordpress.tls.certresolver: letsencrypt
|
||||||
|
traefik.http.routers.wordpress.middlewares: securehttps@file
|
||||||
|
traefik.docker.network: traefik
|
||||||
traefik.enable: "true"
|
traefik.enable: "true"
|
||||||
links:
|
links:
|
||||||
- "{{ mariadb_name }}"
|
- "{{ wordpress_dbcontainer }}"
|
||||||
env:
|
env:
|
||||||
WORDPRESS_DB_NAME: "{{ wordpress_dbname }}"
|
WORDPRESS_DB_NAME: "{{ wordpress_dbname }}"
|
||||||
WORDPRESS_DB_USER: "{{ wordpress_dbuser }}"
|
WORDPRESS_DB_USER: "{{ wordpress_dbuser }}"
|
||||||
WORDPRESS_DB_PASSWORD: "{{ wordpress_dbpass }}"
|
WORDPRESS_DB_PASSWORD: "{{ wordpress_dbpass }}"
|
||||||
WORDPRESS_DB_HOST: "{{ mariadb_name }}"
|
WORDPRESS_DB_HOST: "{{ wordpress_dbcontainer }}"
|
||||||
|
@ -10,6 +10,7 @@ HOST[4]="prom.${DOMAIN}"
|
|||||||
HOST[5]="grafana.${DOMAIN}"
|
HOST[5]="grafana.${DOMAIN}"
|
||||||
HOST[6]="nginx.${DOMAIN}"
|
HOST[6]="nginx.${DOMAIN}"
|
||||||
HOST[7]="vault.${DOMAIN}"
|
HOST[7]="vault.${DOMAIN}"
|
||||||
|
HOST[8]="wordpress.${DOMAIN}"
|
||||||
|
|
||||||
# Get Vagrantbox guest IP
|
# Get Vagrantbox guest IP
|
||||||
VAGRANT_OUTPUT=$(vagrant ssh -c "hostname -I | cut -d' ' -f2" 2>/dev/null)
|
VAGRANT_OUTPUT=$(vagrant ssh -c "hostname -I | cut -d' ' -f2" 2>/dev/null)
|
||||||
|
Loading…
Reference in New Issue
Block a user