ansible-roles/nginx/tasks/nginx-letsencrypt.yml

30 lines
1.1 KiB
YAML
Raw Normal View History

---
- block:
- name: Install the letsencrypt conf
template: src={{ item }}.j2 dest=/etc/nginx/conf.d/{{ item }} owner=root group=root mode=0644
with_items: '{{ nginx_letsencrypt_proxy_conf }}'
notify: Reload nginx
- name: Create the acme hooks directory if it does not yet exist
file: dest={{ letsencrypt_acme_services_scripts_dir }} state=directory owner=root group=root
- name: Install a letsencrypt hook for nginx
copy: src=nginx-letsencrypt-acme.sh dest={{ letsencrypt_acme_services_scripts_dir }}/nginx owner=root group=root mode=4555
when:
- letsencrypt_acme_install is defined and letsencrypt_acme_install
- nginx_letsencrypt_managed
tags: [ 'nginx', 'letsencrypt' ]
- block:
- name: Disable the letsencrypt conf
file: dest=/etc/nginx/conf.d/letsencrypt-proxy.conf state=absent
notify: nginx2 reload
- name: Remove the letsencrypt hook for nginx
file: path={{ letsencrypt_acme_services_scripts_dir }}/nginx state=absent
when: not nginx_letsencrypt_managed
tags: [ 'nginx', 'letsencrypt' ]