netz39-infra-ansible/roles/dehydrated/tasks/main.yml
2021-02-01 20:57:41 +01:00

42 lines
1.1 KiB
YAML

---
- name: Gather package facts.
package_facts:
manager: "auto"
- name: Clone dehydrated repo.
ansible.builtin.git:
repo: git@github.com:dehydrated-io/dehydrated.git
dest: "{{ dehydrated_location }}"
version: "{{ dehydrated_version }}"
- name: Ensure dehydrated symlink is present.
ansible.builtin.file:
src: "{{ dehydrated_location }}/dehydrated"
dest: "{{ dehydrated_path }}"
state: link
# copy config
- name: Ensure domains.txt is present.
ansible.builtin.template:
src: /templates/domains.txt.j2
dest: "{{ dehydrated_config }}/domains.txt"
register: dehydomains
- name: Ensure config is present.
ansible.builtin.template:
src: /templates/config.j2
dest: "{{ dehydrated_config }}/config"
register: dehyconfig
- name: Create wellknown directory.
file:
state: directory
path: /var/www/letsencrypt
- name: Register account.
command: "{{ dehydrated_path }} --register --accept-terms"
when: dehyconfig.changed
- name: Initial dehydrated run.
command: "{{ dehydrated_path }} --cron"
when: dehyconfig.changed or dehydomains.changed