ansible/roles/nginx/tasks/main.yml

30 lines
631 B
YAML

---
- name: Install webserver
package:
state: latest
name:
- nginx
- dehydrated
- name: acme mail
copy:
dest: "/etc/dehydrated/conf.d/mail"
content: "CONTACT_EMAIL={{ nginx_acme_mail }}"
- name: get let's encrypt account
command: /usr/bin/dehydrated --register --accept-terms
args:
creates: /var/lib/dehydrated/accounts
- name: nginx default config
notify: reload nginx
template:
src: default.nginx
dest: /etc/nginx/sites-available/default
- name: nginx snippets for acme
notify: reload nginx
template:
src: snippets-tls.nginx
dest: /etc/nginx/snippets/tls-acme.conf