netz39-infra-ansible/roles/dehydrated/tasks/main.yml

60 lines
No EOL
1.4 KiB
YAML

---
- name: Gather package facts.
package_facts:
manager: "auto"
- name: Ensure git and curl are installed.
package:
name:
- git
- curl
state: present
- name: Clone dehydrated repo.
git:
repo: 'https://github.com/dehydrated-io/dehydrated.git'
dest: "{{ dehydrated_location }}"
version: "{{ dehydrated_version }}"
- name: Ensure dehydrated symlink is present.
file:
src: "{{ dehydrated_location }}/dehydrated"
dest: "{{ dehydrated_binary }}"
state: link
- name: Ensure config directory is present.
file:
path: "{{ dehydrated_config_dir }}"
state: directory
mode: "0711"
- name: Ensure wellknown directory is present.
file:
path: "{{ dehydrated_wellknown_dir }}"
state: directory
mode: "0755"
- name: Ensure certs directory is present.
file:
path: "{{ dehydrated_certs_dir }}"
state: directory
mode: "0700"
- name: Ensure domains.txt is present.
file:
path: "{{ dehydrated_config_dir }}/domains.txt"
state: touch
- name: Ensure config is present.
template:
src: config.j2
dest: "{{ dehydrated_config_dir }}/config"
notify: dehydrated register
- name: Install dehydrated cron job.
cron:
name: renew dehydrated certs
hour: dehydrated_cron_hour
minute: dehydrated_cron_minute
day: dehydrated_cron_day
job: "{{ dehydrated_binary }} -c -g"