ansible-config/roles/nginx/tasks/main.yml
Alexander Dietrich 7956d09b3e New nginx role
2018-11-10 00:20:18 +01:00

37 lines
672 B
YAML

---
- name: install nginx
apt:
name: "{{ nginx_package }}"
cache_valid_time: 86400
- name: create directories
file:
path: "{{ item }}"
state: directory
with_items:
- /var/www/_acme-challenge
- /var/www/_error-pages
- name: copy error-pages
copy:
src: error-pages/
dest: /var/www/_error-pages/
- name: copy snippets
copy:
src: snippets/
dest: /etc/nginx/snippets/
- name: template nginx.conf
template:
src: nginx.conf.j2
dest: /etc/nginx/nginx.conf
backup: yes
notify: reload nginx
- name: remove default site
file:
path: /etc/nginx/sites-enabled/default
state: absent
notify: reload nginx