This role installs a distribution-provided nginx and does some basic configuration on it. It acts as a reverse proxy for the containers that does the TLS offloading and provides an optional HTTP basic authentication page for services that aren't ready to be exposed yet.
23 lines
664 B
YAML
23 lines
664 B
YAML
---
|
|
- name: Check if we need to enable HTTP basic authentication
|
|
ansible.builtin.stat:
|
|
path: /etc/nginx/disable_auth_{{ site_name }}
|
|
register: auth_disabled
|
|
|
|
- name: Install nginx template
|
|
ansible.builtin.template:
|
|
src: nginx-server.j2
|
|
dest: /etc/nginx/sites-available/{{ site_name }}
|
|
mode: "0644"
|
|
vars:
|
|
auth: "{{ htpasswdfile.stat.exists and not auth_disabled.stat.exists }}"
|
|
notify: Reload nginx
|
|
|
|
- name: Activate nginx configuration
|
|
ansible.builtin.file:
|
|
src: /etc/nginx/sites-available/{{ site_name }}
|
|
dest: /etc/nginx/sites-enabled/{{ site_name }}
|
|
owner: root
|
|
group: root
|
|
state: link
|
|
notify: Reload nginx
|