Refactored native-

This commit is contained in:
2023-09-02 13:13:28 +02:00
parent c11333be9a
commit 96b0d10ea8
169 changed files with 94 additions and 94 deletions

View File

@@ -0,0 +1,2 @@
dependencies:
- https-server

View File

@@ -0,0 +1,5 @@
# native https-redirect
## see
- https://stackoverflow.com/questions/6045020/how-to-redirect-to-a-different-domain-using-nginx
- https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html

View File

@@ -0,0 +1,12 @@
---
- name: recieve redirect source certificates
command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{item.source}}
loop: "{{domain_mappings}}"
- name: configure nginx redirect configurations
vars:
domain: "{{item.source}}"
target_domain: "{{item.target}}"
template: src=redirect.domain.nginx.conf.j2 dest=/etc/nginx/conf.d/{{ domain }}.conf
loop: "{{domain_mappings}}"
notify: restart nginx

View File

@@ -0,0 +1,5 @@
server {
server_name {{domain}};
{% include 'roles/letsencrypt/templates/ssl_header.j2' %}
return 301 https://{{target_domain}}$request_uri;
}