forked from gergely/calendar-social
43 lines
891 B
YAML
43 lines
891 B
YAML
|
---
|
||
|
|
||
|
- name: Install Nginx
|
||
|
dnf:
|
||
|
name: "{{ item }}"
|
||
|
state: present
|
||
|
with_items:
|
||
|
- nginx
|
||
|
|
||
|
- name: Create the Nginx configuration file for SSL
|
||
|
template:
|
||
|
src: site-ssl.conf.j2
|
||
|
dest: /etc/nginx/conf.d/{{ project_name }}-ssl.conf
|
||
|
when: use_ssl
|
||
|
notify: Reload Nginx
|
||
|
|
||
|
- name: Create the Nginx configuration file (non-SSL)
|
||
|
template:
|
||
|
src: site.conf.j2
|
||
|
dest: /etc/nginx/conf.d/{{ project_name }}.conf
|
||
|
when: not use_ssl
|
||
|
notify: Reload Nginx
|
||
|
|
||
|
- name: Ensure that the default site is removed
|
||
|
file:
|
||
|
path: /etc/nginx/conf.d/default.conf
|
||
|
state: absent
|
||
|
|
||
|
- name: Ensure Nginx service is started, enable service on restart
|
||
|
service:
|
||
|
name: nginx
|
||
|
state: restarted
|
||
|
enabled: yes
|
||
|
when: enabled
|
||
|
|
||
|
- name: Stop nginx for local dev, disable service
|
||
|
service:
|
||
|
name: nginx
|
||
|
state: stopped
|
||
|
enabled: no
|
||
|
notify: Stop Nginx
|
||
|
when: not enabled
|