mirror of
https://github.com/FAUSheppy/no-secrets-athq-ansible
synced 2025-12-07 10:41:37 +01:00
feat: media configuration with cert header
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
- hosts: web1
|
- hosts: web1
|
||||||
roles:
|
roles:
|
||||||
- { role : web1, tags : [ "web1" ] }
|
- { role : web1, tags : [ "web1" ] }
|
||||||
|
- { role : media, tags : [ "media" ] }
|
||||||
|
|
||||||
- hosts: mail
|
- hosts: mail
|
||||||
roles:
|
roles:
|
||||||
|
|||||||
2
roles/media/files/htpasswd
Normal file
2
roles/media/files/htpasswd
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
kathi:$y$j9T$HISTORY_PURGED_SECRET
|
||||||
|
sheppy:$y$HISTORY_PURGED_SECRET
|
||||||
28
roles/media/files/nginx_media.conf
Normal file
28
roles/media/files/nginx_media.conf
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
map $http_x_nginx_cert_auth $basic_auth_val {
|
||||||
|
default "private";
|
||||||
|
true off;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
|
||||||
|
|
||||||
|
autoindex on;
|
||||||
|
autoindex_localtime on;
|
||||||
|
|
||||||
|
listen 8000;
|
||||||
|
root /var/www/media;
|
||||||
|
|
||||||
|
add_header Vary Accept-Encoding;
|
||||||
|
add_header Access-Control-Allow-Origin $http_origin;
|
||||||
|
|
||||||
|
location /videos/{
|
||||||
|
default_type video/mp4;
|
||||||
|
limit_rate 2m;
|
||||||
|
autoindex on;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /auth/{
|
||||||
|
auth_basic $basic_auth_val;
|
||||||
|
auth_basic_user_file /etc/nginx/htpasswd;
|
||||||
|
}
|
||||||
|
}
|
||||||
2
roles/media/meta/main.yml
Normal file
2
roles/media/meta/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
dependencies:
|
||||||
|
- global-handlers
|
||||||
17
roles/media/tasks/main.yaml
Normal file
17
roles/media/tasks/main.yaml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
- name: Install Nginx
|
||||||
|
apt:
|
||||||
|
pkg:
|
||||||
|
- nginx
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Deploy nginx-config (page)
|
||||||
|
copy:
|
||||||
|
src: nginx_media.conf
|
||||||
|
dest: /etc/nginx/sites-available/media.conf
|
||||||
|
notify: restart nginx
|
||||||
|
|
||||||
|
- name: Deploy nginx basic auth file
|
||||||
|
copy:
|
||||||
|
src: htpasswd
|
||||||
|
dest: /etc/nginx/
|
||||||
|
notify: restart nginx
|
||||||
Reference in New Issue
Block a user