No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Julien Dessaux 1c1b99597a
All checks were successful
main / test (push) Successful in 1m6s
feat(role): rewrote nearly everything
2026-11-20 12:25:37 +01:00
.forgejo/workflows feat(role): rewrote nearly everything 2026-11-20 12:25:37 +01:00
defaults feat(role): rewrote nearly everything 2026-11-20 12:25:37 +01:00
files feat(role): initial import 2026-05-23 22:08:19 +02:00
handlers feat(role): rewrote nearly everything 2026-11-20 12:25:37 +01:00
meta feat(role): rewrote nearly everything 2026-11-20 12:25:37 +01:00
tasks feat(role): rewrote nearly everything 2026-11-20 12:25:37 +01:00
templates feat(role): rewrote nearly everything 2026-11-20 12:25:37 +01:00
vars feat(role): rewrote nearly everything 2026-11-20 12:25:37 +01:00
.ansible-lint feat(role): rewrote nearly everything 2026-11-20 12:25:37 +01:00
.gitignore feat(role): rewrote nearly everything 2026-11-20 12:25:37 +01:00
.yamllint feat(role): rewrote nearly everything 2026-11-20 12:25:37 +01:00
ansible.cfg feat(role): rewrote nearly everything 2026-11-20 12:25:37 +01:00
CHANGELOG.md feat(role): initial import 2026-05-23 22:08:19 +02:00
make.pl feat(role): rewrote nearly everything 2026-11-20 12:25:37 +01:00
pyproject.toml feat(role): rewrote nearly everything 2026-11-20 12:25:37 +01:00
README.md feat(role): rewrote nearly everything 2026-11-20 12:25:37 +01:00
requirements.yaml feat(role): rewrote nearly everything 2026-11-20 12:25:37 +01:00
uv.lock feat(role): rewrote nearly everything 2026-11-20 12:25:37 +01:00

ansible-role-nginx

This ansible role handles the installation and configuration of Nginx.

Certificates

TLS certificates and private keys are read from the acme_certificates output of the acme OpenTofu remote state, downloaded on the ansible controller.

Each name listed in nginx_certificates is deployed as <name>.crt (full chain) and <name>.key in the nginx configuration directory.

Vhosts

Vhosts are deployed with the create_vhost entry point. The role enforces HTTP to HTTPS redirects.

Structured vhost example

- name: 'Deploy git vhost'
  ansible.builtin.include_role:
    name: 'nginx'
    tasks_from: 'create_vhost'
  vars:
    nginx_vhost:
      name: 'git'
      server_names: ['git.adyxax.org']
      certificate: 'adyxax.org'
      headers: 'secure'          # base | secure (default) | static | unsafe_inline_csp
      extra_config: |            # optional
        client_max_body_size 1G;
      locations:
        - path: '/'
          proxy_pass: 'http://127.0.0.1:3000'
        - path: '/static/'
          root: '/srv/git'
          headers: 'static'      # optional, replaces the server headers
          extra_config: |        # optional
            try_files $uri =404;

Raw vhost example

For anything the structured form cannot express, pass already rendered configuration in content:

- name: 'Render myapp vhost'
  ansible.builtin.set_fact:
    _myapp_vhost: "{{ lookup('ansible.builtin.template', 'vhost.conf') }}"

- name: 'Deploy myapp vhost'
  ansible.builtin.include_role:
    name: 'nginx'
    tasks_from: 'create_vhost'
  vars:
    nginx_vhost:
      name: 'myapp'
      content: '{{ _myapp_vhost }}'