sce/roles/nginx/tasks/site.yml
Ivo C.S. Wingelaar 33a9eef0fa
Add basic nginx role
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.
2024-10-13 11:33:33 +02:00

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