mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
Restructured service und web role naming in inventor
This commit is contained in:
16
roles/web-svc-redir-domains/README.md
Normal file
16
roles/web-svc-redir-domains/README.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# Nginx Redirect Role
|
||||
|
||||
This Ansible role configures Nginx to perform 301 redirects from one domain to another. It handles SSL certificate retrieval for the source domains and sets up the Nginx configuration to redirect to the specified target domains.
|
||||
|
||||
## Role Variables
|
||||
|
||||
- `domain_mappings`: A list of objects with `source` and `target` properties specifying the domains to redirect from and to.
|
||||
- `users.administrator.email`: The email used for SSL certificate registration with Let's Encrypt.
|
||||
|
||||
## Dependencies
|
||||
|
||||
- `srv-web-7-6-https`: A role for setting up HTTPS for Nginx
|
||||
- `letsencrypt`: A role for managing SSL certificates with Let's Encrypt
|
||||
|
||||
## Author Information
|
||||
This role was created in 2023 by [Kevin Veen-Birkenbach](https://www.veen.world/).
|
24
roles/web-svc-redir-domains/meta/main.yml
Normal file
24
roles/web-svc-redir-domains/meta/main.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
galaxy_info:
|
||||
author: "Kevin Veen-Birchenbach"
|
||||
description: "Configures Nginx to perform 301 redirects based on a list of source→target domain mappings."
|
||||
license: "CyMaIS NonCommercial License (CNCL)"
|
||||
license_url: "https://s.veen.world/cncl"
|
||||
company: |
|
||||
Kevin Veen-Birchenbach
|
||||
Consulting & Coaching Solutions
|
||||
https://www.veen.world
|
||||
galaxy_tags:
|
||||
- nginx
|
||||
- redirect
|
||||
- domains
|
||||
repository: "https://github.com/kevinveenbirkenbach/cymais"
|
||||
issue_tracker_url: "https://github.com/kevinveenbirkenbach/cymais/issues"
|
||||
documentation: "https://github.com/kevinveenbirkenbach/cymais/tree/main/roles/web-svc-redir-domains"
|
||||
min_ansible_version: "2.9"
|
||||
platforms:
|
||||
- name: Any
|
||||
versions: [ all ]
|
||||
dependencies:
|
||||
- srv-web-7-6-https
|
||||
|
7
roles/web-svc-redir-domains/tasks/main.yml
Normal file
7
roles/web-svc-redir-domains/tasks/main.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
- name: "Include domains redirects"
|
||||
include_tasks: redirect-domain.yml
|
||||
vars:
|
||||
domain: "{{ item.source }}"
|
||||
target: "{{ item.target }}"
|
||||
loop: "{{domain_mappings}}"
|
9
roles/web-svc-redir-domains/tasks/redirect-domain.yml
Normal file
9
roles/web-svc-redir-domains/tasks/redirect-domain.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
- name: "include task receive certbot certificate"
|
||||
include_role:
|
||||
name: srv-web-6-6-tls-core
|
||||
|
||||
- name: "Deploying NGINX redirect configuration for {{ domain }}"
|
||||
template:
|
||||
src: redirect.domain.nginx.conf.j2
|
||||
dest: "{{ nginx.directories.http.servers }}{{ domain }}.conf"
|
||||
notify: restart nginx
|
@@ -0,0 +1,6 @@
|
||||
server {
|
||||
server_name {{ domain }};
|
||||
{% include 'roles/net-letsencrypt/templates/ssl_header.j2' %}
|
||||
|
||||
return 301 https://{{ target }}$request_uri;
|
||||
}
|
1
roles/web-svc-redir-domains/vars/main.yml
Normal file
1
roles/web-svc-redir-domains/vars/main.yml
Normal file
@@ -0,0 +1 @@
|
||||
application_id: "redir-domains"
|
Reference in New Issue
Block a user