No description
- Prolog 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| .forgejo/workflows | ||
| defaults | ||
| files | ||
| handlers | ||
| meta | ||
| tasks | ||
| templates | ||
| vars | ||
| .ansible-lint | ||
| .gitignore | ||
| .yamllint | ||
| ansible.cfg | ||
| CHANGELOG.md | ||
| make.pl | ||
| pyproject.toml | ||
| README.md | ||
| requirements.yaml | ||
| uv.lock | ||
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 }}'