ansible-config/roles/nginx/tasks/main.yml
Alexander Dietrich bbb7c76eef Update nginx role
2020-03-23 20:43:06 +01:00

43 lines
765 B
YAML

---
- name: install nginx
apt:
name: "{{ nginx_packages }}"
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/
- name: copy openssl.cnf
copy:
src: openssl.cnf
dest: /etc/ssl/
backup: yes
notify: restart nginx
- name: template nginx.conf
template:
src: nginx.conf
dest: /etc/nginx/
backup: yes
notify: reload nginx
- name: remove default site
file:
path: /etc/nginx/sites-enabled/default
state: absent
notify: reload nginx