[add] role:authelia-and-nginx
This commit is contained in:
parent
a947c4900e
commit
15af3efdab
4 changed files with 67 additions and 0 deletions
3
ansible/roles/authelia-and-nginx/defaults/main.json
Normal file
3
ansible/roles/authelia-and-nginx/defaults/main.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"var_authelia_and_nginx_domain": "authelia.example.org"
|
||||||
|
}
|
3
ansible/roles/authelia-and-nginx/info.md
Normal file
3
ansible/roles/authelia-and-nginx/info.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
## Verweise
|
||||||
|
|
||||||
|
- [Authelia-Dokumentation](https://www.authelia.com/integration/proxies/nginx/)
|
35
ansible/roles/authelia-and-nginx/tasks/main.json
Normal file
35
ansible/roles/authelia-and-nginx/tasks/main.json
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "deactivate default site",
|
||||||
|
"become": true,
|
||||||
|
"ansible.builtin.file": {
|
||||||
|
"state": "absent",
|
||||||
|
"dest": "/etc/nginx/sites-enabled/default"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "emplace configuration | data",
|
||||||
|
"become": true,
|
||||||
|
"ansible.builtin.template": {
|
||||||
|
"src": "conf.j2",
|
||||||
|
"dest": "/etc/nginx/sites-available/{{var_authelia_and_nginx_domain}}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "emplace configuration | link",
|
||||||
|
"become": true,
|
||||||
|
"ansible.builtin.file": {
|
||||||
|
"state": "link",
|
||||||
|
"src": "/etc/nginx/sites-available/{{var_authelia_and_nginx_domain}}",
|
||||||
|
"dest": "/etc/nginx/sites-enabled/{{var_authelia_and_nginx_domain}}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "restart nginx",
|
||||||
|
"become": true,
|
||||||
|
"ansible.builtin.systemd_service": {
|
||||||
|
"state": "restarted",
|
||||||
|
"name": "nginx"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
26
ansible/roles/authelia-and-nginx/templates/conf.j2
Normal file
26
ansible/roles/authelia-and-nginx/templates/conf.j2
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name auth.*;
|
||||||
|
|
||||||
|
return 301 https://$server_name$request_uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl http2;
|
||||||
|
server_name {{var_authelia_and_nginx_domain}};
|
||||||
|
|
||||||
|
# include /config/nginx/snippets/ssl.conf;
|
||||||
|
ssl_certificate /etc/ssl/certs/{{var_authelia_and_nginx_domain}}.pem;
|
||||||
|
ssl_certificate_key /etc/ssl/private/{{var_authelia_and_nginx_domain}}.pem;
|
||||||
|
|
||||||
|
set $upstream http://localhost:9091;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
# include /config/nginx/snippets/proxy.conf;
|
||||||
|
proxy_pass $upstream;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /api/verify {
|
||||||
|
proxy_pass $upstream;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue