diff --git a/roles/dehydrated-domains/meta/main.yml b/roles/dehydrated-domains/meta/main.yml new file mode 100644 index 0000000..5445214 --- /dev/null +++ b/roles/dehydrated-domains/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: +- role: dehydrated \ No newline at end of file diff --git a/roles/dehydrated/defaults/main.yml b/roles/dehydrated/defaults/main.yml new file mode 100644 index 0000000..74a8e83 --- /dev/null +++ b/roles/dehydrated/defaults/main.yml @@ -0,0 +1,8 @@ +--- +dehydrated_version: "v0.7.0" +dehydrated_contact_email: "" +dehydrated_location: "/usr/local/share/dehydrated" +dehydrated_binary: "/usr/local/bin/dehydrated" +dehydrated_config_dir: "/usr/local/etc/dehydrated" +dehydrated_certs_dir: "{{ dehydrated_config_dir }}/certs" +dehydrated_wellknown_dir: "{{ dehydrated_config_dir }}/challenge" diff --git a/roles/dehydrated/handlers/main.yml b/roles/dehydrated/handlers/main.yml new file mode 100644 index 0000000..4498b79 --- /dev/null +++ b/roles/dehydrated/handlers/main.yml @@ -0,0 +1,6 @@ +--- +- name: dehydrated register + command: "{{ dehydrated_binary }} --register --accept-terms" + +- name: dehydrated cron + command: "{{ dehydrated_binary }} --cron" \ No newline at end of file diff --git a/roles/dehydrated/tasks/main.yml b/roles/dehydrated/tasks/main.yml new file mode 100644 index 0000000..8614ded --- /dev/null +++ b/roles/dehydrated/tasks/main.yml @@ -0,0 +1,53 @@ +--- +- 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 + \ No newline at end of file diff --git a/roles/dehydrated/templates/config.j2 b/roles/dehydrated/templates/config.j2 new file mode 100644 index 0000000..d6d3dc7 --- /dev/null +++ b/roles/dehydrated/templates/config.j2 @@ -0,0 +1,3 @@ +HOOK={{ dehydrated_config_dir }}/hook.sh +WELLKNOWN={{ dehydrated_wellknown_dir }} +CONTACT_EMAIL={{ dehydrated_contact_email }}