nginx/README.md

67 lines
2.3 KiB
Markdown
Raw Normal View History

2022-06-08 20:25:54 +02:00
# NGINX ansible role
Install nginx for debian
This role is part of my ansible roles. It is made to interact with other roles that are listed here, and require some variables.
## Role required:
## Variable required:
```
ansible_managed: str, msg indicating a file managed by ansible
2022-06-19 22:40:12 +02:00
http_sites: dictionnary of site, see the Http Sites section bellow
```
## Optionnal variables
```
in_memoriam: str[], list of name to remember that will be advertised by `X-Clacks-Overhead`
2022-07-17 18:54:55 +02:00
ssl_reverse_proxy_upstream:
`upstream_key`: # `upstream_key` is a string value that need to be unique in the same host
to: str, the address of destination, either a domain name or ip address
sni_server_name: str, the server_name expected in the SNI of the incomming connection
to_port: str | int, optionnal, default 443, the port of destination
2022-06-08 20:25:54 +02:00
```
## Add role to you ansible playbook:
To add this role to your project, you can use git submodules:
```
git submodule add ssh://git@gitea.auro.re:2222/Pains-Perdus/nginx.git roles/nginx
git submodule init
```
2022-06-19 22:40:12 +02:00
## Http Sites
The variable `http_sites` is a dictionnary of the http site managed by nginx.
```
http_sites:
`server_name`:
root_snippets:
- ? TODO
locations:
`location`:
2022-07-17 18:54:55 +02:00
templates:
- `template`
2022-07-17 20:13:18 +02:00
config:
- `config`
2022-06-19 22:40:12 +02:00
...
```
`server_name` is the string corresponding to the server name (eg: "example.com").
`root_snippets` is a list of snippets/templates (To be determine) containing configurations for the http server.
2022-07-17 20:13:18 +02:00
`locations` is a dictionnary of location block. `location` (the key of an item) is the location (eg, "/"), `template` are the jinja templates defining the contant of the location block. Other variables can be added to the location block depending on the template used. `config` is a string added directly to the config of the location block.
2022-06-19 22:40:12 +02:00
Inside the templates, `server_name` is accessed with `{{ item.key }}`, en variables of the server block with `{{ item.value.varname }}`.
Inside templates of a location, in addition to the variables of the server block, the variables of the location block can be accessed with `{{ location.value.varname }}`, and the value of `location` with `{{ location.key }}`.
2022-06-08 20:25:54 +02:00
## Copyright
Copyright 2021 Jean-Marie Mineau <histausse@protonmail.com>