ansible-roles/certbot/tasks/main.yml

65 lines
2 KiB
YAML
Raw Normal View History

2019-09-27 00:13:30 +02:00
---
- name: "System compatibility checks"
ansible.builtin.assert:
2019-09-27 00:13:30 +02:00
that:
- ansible_distribution == "Debian"
- ansible_distribution_major_version is version('8', '>=')
2019-09-27 00:13:30 +02:00
msg: only compatible with Debian 9+
- name: Install legacy script on Debian 8
ansible.builtin.include: install-legacy.yml
when:
- ansible_distribution == "Debian"
- ansible_distribution_major_version is version('9', '<')
- name: Install package on Debian 9+
ansible.builtin.include: install-package.yml
when:
- ansible_distribution == "Debian"
- ansible_distribution_major_version is version('9', '>=')
2019-09-27 00:13:30 +02:00
- ansible.builtin.include: acme-challenge.yml
2019-09-27 00:13:30 +02:00
2024-01-11 17:45:55 +01:00
# This is always going to mark a "change".
# Couldn't figure out why !
2019-09-27 00:13:30 +02:00
- name: Deploy hooks are present
ansible.builtin.copy:
2021-06-07 13:04:12 +02:00
src: hooks/deploy/
2019-09-27 00:13:30 +02:00
dest: /etc/letsencrypt/renewal-hooks/deploy/
mode: "0700"
owner: root
group: root
- name: Manual deploy hook is present
ansible.builtin.copy:
src: hooks/manual-deploy.sh
dest: /etc/letsencrypt/renewal-hooks/manual-deploy.sh
mode: "0700"
owner: root
group: root
2021-05-03 11:44:59 +02:00
- name: "sync_remote is configured with servers"
ansible.builtin.lineinfile:
2021-05-03 11:44:59 +02:00
dest: /etc/letsencrypt/renewal-hooks/deploy/sync_remote.cf
regexp: "^servers="
2021-05-03 11:44:59 +02:00
line: "servers=\"{{ certbot_hooks_sync_remote_servers | join(' ') }}\""
create: yes
2021-06-07 13:04:12 +02:00
# begining of backward compatibility tasks
- name: Move deploy/commit-etc.sh to deploy/z-commit-etc.sh if present
ansible.builtin.command:
cmd: "mv /etc/letsencrypt/renewal-hooks/deploy/commit-etc.sh /etc/letsencrypt/renewal-hooks/deploy/z-commit-etc.sh"
args:
removes: /etc/letsencrypt/renewal-hooks/deploy/commit-etc.sh
creates: /etc/letsencrypt/renewal-hooks/deploy/z-commit-etc.sh
2021-06-07 13:04:12 +02:00
# end of backward compatibility tasks
- name: "certbot lock is ignored by Git"
ansible.builtin.lineinfile:
dest: /etc/.gitignore
line: letsencrypt/.certbot.lock
create: yes
owner: root
mode: "0600"