From 92bf67b15ff3751b5d4232bf0afb426d43a8a302 Mon Sep 17 00:00:00 2001 From: Kris Lamoureux Date: Sat, 13 Mar 2021 23:52:50 -0500 Subject: [PATCH] Add router rule variable for more flexibility --- dev/host_vars/wordpress.yml | 4 ++++ roles/wordpress/defaults/main.yml | 1 + roles/wordpress/tasks/main.yml | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/dev/host_vars/wordpress.yml b/dev/host_vars/wordpress.yml index 1fb5d4c..83b139e 100644 --- a/dev/host_vars/wordpress.yml +++ b/dev/host_vars/wordpress.yml @@ -24,6 +24,10 @@ wordpress_dbversion: latest wordpress_dbpass: password # multisite (enable in admin panel then uncomment) +#wordpress_rule: "Host(`{{ wordpress_domain }}`) || +# Host(`site1.{{ wordpress_domain }}`) || +# Host(`site2.{{ wordpress_domain }}`)" +# #wordpress_config_extra: | # define('MULTISITE', {{ wordpress_multisite | string }}); # define('SUBDOMAIN_INSTALL', true); diff --git a/roles/wordpress/defaults/main.yml b/roles/wordpress/defaults/main.yml index 956e892..0aa7fa2 100644 --- a/roles/wordpress/defaults/main.yml +++ b/roles/wordpress/defaults/main.yml @@ -1,5 +1,6 @@ # settings wordpress_multisite: false +wordpress_rule: "Host(`{{ wordpress_domain }}`)" wordpress_config_extra: | define('WP_ALLOW_MULTISITE', {{ wordpress_multisite | string }} ); diff --git a/roles/wordpress/tasks/main.yml b/roles/wordpress/tasks/main.yml index a4e3e4c..2e3c1c6 100644 --- a/roles/wordpress/tasks/main.yml +++ b/roles/wordpress/tasks/main.yml @@ -18,7 +18,7 @@ volumes: - "{{ wordpress_docroot }}:/var/www/html" labels: - traefik.http.routers.wordpress.rule: "Host(`{{ wordpress_domain }}`)" + traefik.http.routers.wordpress.rule: "{{ wordpress_rule }}" traefik.http.routers.wordpress.entrypoints: websecure traefik.http.routers.wordpress.tls.certresolver: letsencrypt traefik.http.routers.wordpress.middlewares: securehttps@file