Draft of a domainrewrite role.
This commit is contained in:
parent
9670cbc5e0
commit
4e7493ff0b
3 changed files with 30 additions and 0 deletions
22
roles/httpd/domainrewrite/tasks/main.yml
Normal file
22
roles/httpd/domainrewrite/tasks/main.yml
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
# Expected vars
|
||||||
|
# - website...
|
||||||
|
# - destname..
|
||||||
|
# - path..
|
||||||
|
# - target..
|
||||||
|
# - status..
|
||||||
|
|
||||||
|
- name: Copy in domain rewrite for {{destname}} ({{website}}{{path}})
|
||||||
|
template: >
|
||||||
|
src={{item}}
|
||||||
|
dest=/etc/httpd/conf.d/{{website}}/{{destname}}-rewrite.conf
|
||||||
|
owner=root
|
||||||
|
group=root
|
||||||
|
mode=0644
|
||||||
|
with_first_found:
|
||||||
|
- "{{roles}}/httpd/domainrewrite/templates/domainrewrite.{{destname}}.conf"
|
||||||
|
- "{{roles}}/httpd/domainrewrite/templates/domainrewrite.conf"
|
||||||
|
notify:
|
||||||
|
- restart httpd
|
||||||
|
tags:
|
||||||
|
- httpd
|
||||||
|
- httpd/domainrewrite
|
6
roles/httpd/domainrewrite/templates/domainrewrite.conf
Normal file
6
roles/httpd/domainrewrite/templates/domainrewrite.conf
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
RewriteEngine On
|
||||||
|
{% if path == '/favicon.ico$' %}
|
||||||
|
RewriteRule {{path}} {{target}} [P]
|
||||||
|
{% else %}
|
||||||
|
RewriteRule {{path}} {{target}} [R={{status}},L]
|
||||||
|
{% endif %}
|
2
roles/httpd/domainrewrite/vars/main.yml
Normal file
2
roles/httpd/domainrewrite/vars/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
path: ^/$
|
||||||
|
status: 302
|
Loading…
Add table
Add a link
Reference in a new issue