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

45 lines
967 B
YAML
Raw Normal View History

2020-11-21 23:42:08 +01:00
---
- name: Install NGINX
become: yes
apt:
name: nginx
2020-12-28 17:39:41 +01:00
- 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
2020-11-21 23:42:08 +01:00
- 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