1
0
forked from infra/ansible
infra/roles/web_mc/tasks/main.yml

21 lines
761 B
YAML
Raw Normal View History

2020-12-24 12:38:42 +01:00
---
- name: Create vhost directory
file: path=/var/www/mc state=directory owner=www-data group=www-data
- name: Ensure certificates are available
command: openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/nginx/ssl/{{ mc_domain }}.key -out /etc/nginx/ssl/{{ mc_domain }}.crt -days 730 -subj "/CN={{ mc_domain }}" creates=/etc/nginx/ssl/{{ mc_domain }}.crt
notify: Restart nginx
- name: Configure certificate manager
template: src=certs.j2 dest=/etc/acertmgr/{{ mc_domain }}.conf
notify: Run acertmgr
- name: Configure vhosts
template: src=vhost.j2 dest=/etc/nginx/sites-available/mc
notify: Restart nginx
- name: Enable vhosts
file: src=/etc/nginx/sites-available/mc dest=/etc/nginx/sites-enabled/mc state=link
notify: Restart nginx