mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
Restructured webserver optimation roles
This commit is contained in:
26
roles/web-opt-rdr-www/tasks/main.yml
Normal file
26
roles/web-opt-rdr-www/tasks/main.yml
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
- name: Filter www-prefixed domains from current_play_domains_all
|
||||
set_fact:
|
||||
www_domains: "{{ current_play_domains_all | select('match', '^www\\.') | list }}"
|
||||
|
||||
- name: Include web-opt-rdr-domains role for www-to-bare redirects
|
||||
include_role:
|
||||
name: web-opt-rdr-domains
|
||||
vars:
|
||||
domain_mappings: "{{ www_domains
|
||||
| map('regex_replace',
|
||||
'^www\\.(.+)$',
|
||||
'{ source: \"www.\\1\", target: \"\\1\" }')
|
||||
| map('from_yaml')
|
||||
| list
|
||||
}}"
|
||||
|
||||
- name: Include DNS role to set redirects
|
||||
include_role:
|
||||
name: srv-web-7-7-dns-records
|
||||
vars:
|
||||
cloudflare_api_token: "{{ certbot_dns_api_token }}"
|
||||
cloudflare_domains: "{{ www_domains }}"
|
||||
cloudflare_target_ip: "{{ networks.internet.ip4 }}"
|
||||
cloudflare_proxied: false
|
||||
when: dns_provider == 'cloudflare'
|
Reference in New Issue
Block a user