From 5d8e8f9ded653c3690532e06c3b2b096089daa43 Mon Sep 17 00:00:00 2001 From: David Kilias Date: Tue, 23 Feb 2021 20:54:32 +0100 Subject: [PATCH] separate out crin instead of domains --- roles/dehydrated-cron/defaults/main.yml | 4 ++ .../meta/main.yml | 0 roles/dehydrated-cron/tasks/main.yml | 8 +++ .../README.md | 2 +- roles/dehydrated/defaults/main.yml | 4 -- .../main.yml => dehydrated/tasks/domains.yml} | 0 roles/dehydrated/tasks/install.yml | 52 ++++++++++++++++ roles/dehydrated/tasks/main.yml | 61 +------------------ .../templates/hook.sh.j2 | 0 9 files changed, 67 insertions(+), 64 deletions(-) create mode 100644 roles/dehydrated-cron/defaults/main.yml rename roles/{dehydrated-domains => dehydrated-cron}/meta/main.yml (100%) create mode 100644 roles/dehydrated-cron/tasks/main.yml rename roles/{dehydrated-domains => dehydrated}/README.md (96%) rename roles/{dehydrated-domains/tasks/main.yml => dehydrated/tasks/domains.yml} (100%) create mode 100644 roles/dehydrated/tasks/install.yml rename roles/{dehydrated-domains => dehydrated}/templates/hook.sh.j2 (100%) diff --git a/roles/dehydrated-cron/defaults/main.yml b/roles/dehydrated-cron/defaults/main.yml new file mode 100644 index 0000000..275abdb --- /dev/null +++ b/roles/dehydrated-cron/defaults/main.yml @@ -0,0 +1,4 @@ +--- +dehydrated_cron_minute: "0" +dehydrated_cron_hour: "3" +dehydrated_cron_day: "*/5" diff --git a/roles/dehydrated-domains/meta/main.yml b/roles/dehydrated-cron/meta/main.yml similarity index 100% rename from roles/dehydrated-domains/meta/main.yml rename to roles/dehydrated-cron/meta/main.yml diff --git a/roles/dehydrated-cron/tasks/main.yml b/roles/dehydrated-cron/tasks/main.yml new file mode 100644 index 0000000..13a22bf --- /dev/null +++ b/roles/dehydrated-cron/tasks/main.yml @@ -0,0 +1,8 @@ +--- +- 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" \ No newline at end of file diff --git a/roles/dehydrated-domains/README.md b/roles/dehydrated/README.md similarity index 96% rename from roles/dehydrated-domains/README.md rename to roles/dehydrated/README.md index 6f2f544..816a898 100644 --- a/roles/dehydrated-domains/README.md +++ b/roles/dehydrated/README.md @@ -1,4 +1,4 @@ -# Dehydrated Domains +# Dehydrated Ansible role to configure domains for use with dehydrated diff --git a/roles/dehydrated/defaults/main.yml b/roles/dehydrated/defaults/main.yml index 67a49e5..74a8e83 100644 --- a/roles/dehydrated/defaults/main.yml +++ b/roles/dehydrated/defaults/main.yml @@ -6,7 +6,3 @@ 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" - -dehydrated_cron_minute: "0" -dehydrated_cron_hour: "3" -dehydrated_cron_day: "*/5" diff --git a/roles/dehydrated-domains/tasks/main.yml b/roles/dehydrated/tasks/domains.yml similarity index 100% rename from roles/dehydrated-domains/tasks/main.yml rename to roles/dehydrated/tasks/domains.yml diff --git a/roles/dehydrated/tasks/install.yml b/roles/dehydrated/tasks/install.yml new file mode 100644 index 0000000..b1e2065 --- /dev/null +++ b/roles/dehydrated/tasks/install.yml @@ -0,0 +1,52 @@ +--- +- 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/tasks/main.yml b/roles/dehydrated/tasks/main.yml index 6720424..90c9742 100644 --- a/roles/dehydrated/tasks/main.yml +++ b/roles/dehydrated/tasks/main.yml @@ -1,60 +1,3 @@ --- -- 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" \ No newline at end of file +- include_tasks: install.yml +- include_tasks: domains.yml \ No newline at end of file diff --git a/roles/dehydrated-domains/templates/hook.sh.j2 b/roles/dehydrated/templates/hook.sh.j2 similarity index 100% rename from roles/dehydrated-domains/templates/hook.sh.j2 rename to roles/dehydrated/templates/hook.sh.j2