ansible/roles/web-gw/tasks/main.yml

21 lines
772 B
YAML
Raw Normal View History

2017-07-03 21:18:45 +02:00
---
- name: Ensure certificates are available
command: openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/nginx/ssl/{{ ansible_fqdn }}.key -out /etc/nginx/ssl/{{ ansible_fqdn }}.crt -days 730 -subj "/CN={{ ansible_fqdn }}" creates=/etc/nginx/ssl/{{ ansible_fqdn }}.crt
notify: Restart nginx
2017-11-16 19:02:26 +01:00
- name: Create web content directory
file: path=/var/www/html state=directory mode=0755
2017-11-16 19:02:26 +01:00
2017-07-03 21:18:45 +02:00
- name: Configure certificate manager
template: src=certs.j2 dest=/etc/acme/domains.d/{{ ansible_fqdn }}.conf
notify: Run certmgr
- name: Configure vhosts
template: src=vhost.j2 dest=/etc/nginx/sites-available/www
notify: Restart nginx
- name: Enable vhosts
file: src=/etc/nginx/sites-available/www dest=/etc/nginx/sites-enabled/www state=link
notify: Restart nginx