ansible/roles/web_mc/tasks/main.yml

21 lines
761 B
YAML

---
- 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