infra/roles/stable/nginx/tasks/main.yml

44 lines
967 B
YAML

---
- name: Install NGINX
become: yes
apt:
name: nginx
- name: Default Configuration
become: yes
template:
src: default.j2
dest: /etc/nginx/sites-available/default
- name: Link Default NGINX Configuration
become: yes
file:
src: "/etc/nginx/sites-available/default"
dest: "/etc/nginx/sites-enabled/default"
state: link
- name: Configure Reverse Proxies
become: yes
template:
src: reverse_proxy.conf.j2
dest: /etc/nginx/sites-available/{{item.server_name}}.conf
loop: "{{ servers }}"
- name: Link NGINX Reverse Proxies
become: yes
file:
src: "/etc/nginx/sites-available/{{item.server_name}}.conf"
dest: "/etc/nginx/sites-enabled/{{item.server_name}}.conf"
state: link
loop: "{{ servers }}"
- name: Make sure NGINX Service is running
become: yes
service:
name: nginx
state: restarted
enabled: yes
- name: Run Certbot if needed
include: certbot.yml
when: with_certbot | bool