]> git.phdru.name Git - ansible.git/commitdiff
Feat(install-dehydrated): Install `dehydrated`
authorOleg Broytman <phd@phdru.name>
Fri, 26 Jul 2019 19:22:30 +0000 (22:22 +0300)
committerOleg Broytman <phd@phdru.name>
Fri, 26 Jul 2019 19:24:14 +0000 (22:24 +0300)
Install LetsEncrypt's client `dehydrated`: clone and sync it to the server.

playbooks/debian/roles/install-dehydrated/README.txt [new file with mode: 0644]
playbooks/debian/roles/install-dehydrated/tasks/main.yml [new file with mode: 0644]

diff --git a/playbooks/debian/roles/install-dehydrated/README.txt b/playbooks/debian/roles/install-dehydrated/README.txt
new file mode 100644 (file)
index 0000000..761549e
--- /dev/null
@@ -0,0 +1 @@
+Install LetsEncrypt's client dehydrated: clone and sync it to the server.
diff --git a/playbooks/debian/roles/install-dehydrated/tasks/main.yml b/playbooks/debian/roles/install-dehydrated/tasks/main.yml
new file mode 100644 (file)
index 0000000..16e0854
--- /dev/null
@@ -0,0 +1,45 @@
+- name: Test if dehydrated is already cloned
+  local_action: command test -f /usr/local/src/LetsEncrypt/dehydrated/.git/config
+  failed_when: false
+  register: dehydrated_exist
+  changed_when: dehydrated_exist.rc != 0
+
+- name: Install git
+  local_action:
+    module: apt
+    autoclean: yes
+    autoremove: yes
+    install_recommends: no
+    name: git
+    purge: yes
+    state: latest
+    update_cache: yes
+  when: dehydrated_exist.rc != 0
+
+- name: Prepare to clone dehydrated
+  local_action:
+    module: file
+    path: /usr/local/src/LetsEncrypt
+    state: directory
+  when: dehydrated_exist.rc != 0
+
+- name: Clone dehydrated
+  local_action:
+    module: git
+    repo: https://github.com/lukas2511/dehydrated.git
+    dest: /usr/local/src/LetsEncrypt
+  when: dehydrated_exist.rc != 0
+
+- name: Prepare the server to syncronize dehydrated
+  become: true
+  file:
+    path: /usr/local/src/LetsEncrypt
+    state: directory
+    owner: root
+    group: staff
+    mode: "ug+rwx,o+rx,g+s"
+
+- name: Syncronize dehydrated to the server
+  synchronize:
+    src: /usr/local/src/LetsEncrypt/dehydrated
+    dest: /usr/local/src/LetsEncrypt