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:
35
roles/web-svc-file/README.md
Normal file
35
roles/web-svc-file/README.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# Nginx File Server
|
||||
|
||||
## 🔥 Description
|
||||
|
||||
The Nginx File Server role sets up a simple and secure static file server using [Nginx](https://nginx.org/). It provides an easy way to serve files over HTTPS, including directory listing, `.well-known` support, and automatic SSL/TLS certificate integration via Let's Encrypt.
|
||||
|
||||
## 📖 Overview
|
||||
|
||||
Optimized for Archlinux, this role configures Nginx to act as a lightweight and efficient file server. It ensures that files are served securely, with optional directory browsing enabled, and proper MIME type handling for standard web clients.
|
||||
|
||||
### Key Features
|
||||
- **HTTPS Secured File Hosting:** Automatically retrieves SSL/TLS certificates using Let's Encrypt.
|
||||
- **Autoindex Directory Listing:** Displays files and folders in a clean and human-readable format.
|
||||
- **.well-known Support:** Fully supports ACME and other `.well-known` path requirements.
|
||||
- **Customizable File Path:** Easily adjust the root directory for your files through Ansible variables.
|
||||
- **Local Time Display:** Enhances directory listings by showing local timestamps.
|
||||
|
||||
## 🎯 Purpose
|
||||
|
||||
The Nginx File Server role is ideal for hosting static files, sharing resources internally or externally, and serving ACME challenges for certificate issuance. It offers a reliable and minimalistic alternative to more complex file-sharing solutions.
|
||||
|
||||
## 🚀 Features
|
||||
|
||||
- **Automatic SSL/TLS Certificate Management:** Integrates with Let's Encrypt for secure access.
|
||||
- **Simple Configuration:** Minimal setup with clear, maintainable templates.
|
||||
- **Directory Listings:** Enables browsing through served files with human-readable file sizes and timestamps.
|
||||
- **Static Content Hosting:** Serve any type of static files (documents, software, media, etc.).
|
||||
- **Well-Known Folder Support:** Allows serving validation files and other standardized resources easily.
|
||||
|
||||
## 🔗 Learn More
|
||||
|
||||
- [Nginx Official Website](https://nginx.org/)
|
||||
- [Let's Encrypt](https://letsencrypt.org/)
|
||||
- [HTTP File Server (Wikipedia)](https://en.wikipedia.org/wiki/HTTP_file-server)
|
||||
- [HTTPS (Wikipedia)](https://en.wikipedia.org/wiki/HTTPS)
|
7
roles/web-svc-file/config/main.yml
Normal file
7
roles/web-svc-file/config/main.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
features:
|
||||
matomo: true
|
||||
css: true
|
||||
portfolio_iframe: true
|
||||
domains:
|
||||
canonical:
|
||||
- "files.{{ primary_domain }}"
|
30
roles/web-svc-file/meta/main.yml
Normal file
30
roles/web-svc-file/meta/main.yml
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
galaxy_info:
|
||||
author: "Kevin Veen-Birkenbach"
|
||||
description: |
|
||||
Configures an Nginx-based file server with HTTPS support, automatic SSL/TLS certificate retrieval, directory listing, and .well-known handling for secure static file hosting.
|
||||
license: "CyMaIS NonCommercial License (CNCL)"
|
||||
license_url: "https://s.veen.world/cncl"
|
||||
company: |
|
||||
Kevin Veen-Birkenbach
|
||||
Consulting & Coaching Solutions
|
||||
https://www.veen.world
|
||||
min_ansible_version: "2.9"
|
||||
platforms:
|
||||
- name: Archlinux
|
||||
versions:
|
||||
- rolling
|
||||
galaxy_tags:
|
||||
- nginx
|
||||
- https
|
||||
- file-server
|
||||
- static-files
|
||||
- ssl
|
||||
- letsencrypt
|
||||
- automation
|
||||
repository: "https://s.veen.world/cymais"
|
||||
issue_tracker_url: "https://s.veen.world/cymaisissues"
|
||||
documentation: "https://s.veen.world/cymais"
|
||||
dependencies:
|
||||
- srv-web-7-6-https
|
||||
- gen-git
|
13
roles/web-svc-file/tasks/main.yml
Normal file
13
roles/web-svc-file/tasks/main.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
- name: "include role for {{application_id}} to receive certs & do modification routines"
|
||||
include_role:
|
||||
name: srv-web-7-6-composer
|
||||
vars:
|
||||
domain: "{{ domains | get_domain(application_id) }}"
|
||||
http_port: "{{ ports.localhost.http[application_id] }}"
|
||||
|
||||
- name: "generate {{domains | get_domain(application_id)}}.conf"
|
||||
template:
|
||||
src: "nginx.conf.j2"
|
||||
dest: "{{ nginx.directories.http.servers }}{{ domains | get_domain(application_id) }}.conf"
|
||||
notify: restart nginx
|
26
roles/web-svc-file/templates/nginx.conf.j2
Normal file
26
roles/web-svc-file/templates/nginx.conf.j2
Normal file
@@ -0,0 +1,26 @@
|
||||
server
|
||||
{
|
||||
server_name {{domains | get_domain(application_id)}};
|
||||
|
||||
{% include 'roles/net-letsencrypt/templates/ssl_header.j2' %}
|
||||
|
||||
{% include 'roles/srv-web-7-7-inj-compose/templates/global.includes.conf.j2'%}
|
||||
|
||||
{% include 'roles/srv-proxy-7-4-core/templates/headers/content_security_policy.conf.j2' %}
|
||||
charset utf-8;
|
||||
|
||||
location /
|
||||
{
|
||||
alias {{nginx.directories.data.files}}; {# Path to your file directory #}
|
||||
autoindex on; {# Enable directory listing #}
|
||||
autoindex_exact_size off; {# Display sizes in a human-readable format #}
|
||||
autoindex_localtime on; {# Show local time #}
|
||||
}
|
||||
|
||||
location /.well-known/ {
|
||||
alias {{nginx.directories.data.well_known}};
|
||||
allow all;
|
||||
default_type "text/plain";
|
||||
autoindex on;
|
||||
}
|
||||
}
|
2
roles/web-svc-file/vars/main.yml
Normal file
2
roles/web-svc-file/vars/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
application_id: "file"
|
||||
domain: "{{ domains | get_domain(application_id) }}"
|
Reference in New Issue
Block a user