ansible-roles/certbot/tasks/acme-challenge.yml
Jérémy Lecour 00fe225a3c
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |2615|7|2608|177|:+1: Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/278//ansiblelint">Evolix » ansible-roles » unstable #278</a>
gitea/ansible-roles/pipeline/head This commit looks good
force: [yes,no] → force [true,false]
2023-06-28 13:25:30 +02:00

53 lines
1.4 KiB
YAML

---
- name: Certbot work directory is present
ansible.builtin.file:
dest: "{{ certbot_work_dir }}"
state: directory
mode: "0755"
- name: Check if Nginx is installed
ansible.builtin.stat:
path: /etc/nginx
register: is_nginx
- name: ACME challenge for Nginx is installed
ansible.builtin.template:
src: acme-challenge/nginx.conf.j2
dest: /etc/nginx/snippets/letsencrypt.conf
force: true
notify: reload nginx
when: is_nginx.stat.exists
- name: Check if Apache is installed
ansible.builtin.stat:
path: /usr/sbin/apachectl
register: is_apache
- name: ACME challenge for Apache
block:
- name: ACME challenge for Apache is installed
ansible.builtin.template:
src: acme-challenge/apache.conf.j2
dest: /etc/apache2/conf-available/letsencrypt.conf
force: true
notify: reload apache
- name: ACME challenge for Apache is enabled
ansible.builtin.command:
cmd: "a2enconf letsencrypt"
register: command_result
changed_when: "'Enabling' in command_result.stderr"
notify: reload apache
when: is_apache.stat.exists
- name: Check if HAProxy is installed
ansible.builtin.stat:
path: /etc/haproxy
register: is_haproxy
- name: ACME challenge for HAProxy is installed
ansible.builtin.debug:
msg: "ACME challenge configuration for HAProxy must be configured manually"
when: is_haproxy.stat.exists