No description
Find a file
2022-08-07 18:46:03 +02:00
handlers add some files 2022-06-08 22:34:50 +02:00
tasks some updates 2022-08-07 18:43:35 +02:00
templates add dedicated logs to http sites 2022-08-07 18:46:03 +02:00
LICENSE first draft 2022-06-08 20:25:54 +02:00
README.md some updates 2022-08-07 18:43:35 +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
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 (currently, raw strings added to the config (like `location.my_location.config`)
    use_certbot: bool, optionnal, indicate that the certbot role should generate this certificat. 
    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 }}.

Recommander role

The certbot role is recommanded to use with this role. It generate LE certificates and has this role has a dependency.

https://gitea.auro.re/Pains-Perdus/certbot

Copyright 2021 Jean-Marie Mineau histausse@protonmail.com