Ansible-Roles/roles/nginx/tasks/nginx-letsencrypt.yml
2026-05-08 22:12:36 +03:00

32 lines
940 B
YAML

---
- name: Configure Letsencrypt
when:
- letsencrypt_acme_install is defined and letsencrypt_acme_install
- nginx_letsencrypt_managed
tags: [nginx, letsencrypt]
block:
- name: Create the acme hooks directory if it does not yet exist
ansible.builtin.file:
dest: "{{ letsencrypt_acme_services_scripts_dir }}"
state: directory
owner: root
group: root
mode: "0755"
- name: Install a letsencrypt hook for nginx
ansible.builtin.copy:
src: nginx-letsencrypt-acme.sh
dest: "{{ letsencrypt_acme_services_scripts_dir }}/nginx"
owner: root
group: root
mode: "0755"
- name: Remove Letsencrypt
when: not nginx_letsencrypt_managed
tags: [nginx, letsencrypt]
block:
- name: Remove the letsencrypt hook for nginx
ansible.builtin.file:
path: "{{ letsencrypt_acme_services_scripts_dir }}/nginx"
state: absent