66 lines
2.3 KiB
Markdown
66 lines
2.3 KiB
Markdown
# 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
|
|
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`
|
|
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
|
|
```
|
|
|
|
## 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
|
|
```
|
|
|
|
## 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`:
|
|
templates:
|
|
- `template`
|
|
config:
|
|
- `config`
|
|
...
|
|
```
|
|
|
|
`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.
|
|
|
|
`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.
|
|
|
|
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 }}`.
|
|
|
|
## Copyright
|
|
|
|
Copyright 2021 Jean-Marie Mineau <histausse@protonmail.com>
|