ansible-config/roles/nginx/tasks/main.yml

37 lines
672 B
YAML
Raw Normal View History

2015-08-29 23:44:14 +02:00
---
- name: install nginx
apt:
2018-11-03 16:20:39 +01:00
name: "{{ nginx_package }}"
cache_valid_time: 86400
2015-08-29 23:44:14 +02:00
2018-11-03 16:20:39 +01:00
- name: create directories
file:
2018-11-03 16:20:39 +01:00
path: "{{ item }}"
state: directory
with_items:
- /var/www/_acme-challenge
- /var/www/_error-pages
2015-08-29 23:44:14 +02:00
2018-11-03 16:20:39 +01:00
- name: copy error-pages
copy:
2018-11-03 16:20:39 +01:00
src: error-pages/
dest: /var/www/_error-pages/
2015-08-29 23:44:14 +02:00
2018-11-03 16:20:39 +01:00
- name: copy snippets
copy:
src: snippets/
dest: /etc/nginx/snippets/
2017-10-03 17:30:06 +02:00
2017-02-10 20:38:12 +01:00
- name: template nginx.conf
template:
2018-11-03 16:20:39 +01:00
src: nginx.conf.j2
2017-02-10 20:38:12 +01:00
dest: /etc/nginx/nginx.conf
backup: yes
2018-11-03 16:20:39 +01:00
notify: reload nginx
- name: remove default site
file:
path: /etc/nginx/sites-enabled/default
state: absent
notify: reload nginx