Index: /main/waeup-ansible/letsencrypt.yml
===================================================================
--- /main/waeup-ansible/letsencrypt.yml	(revision 14706)
+++ /main/waeup-ansible/letsencrypt.yml	(revision 14706)
@@ -0,0 +1,23 @@
+---
+# This ansible-playbook installs letsencrypt certs
+#
+# What it does:
+#   - registers LE account
+#   - requests/creates first-time certificates
+#   - requests new certs if list of domains changed
+##
+# REVIEW/EDIT THE VARS BELOW BEFORE RUNNING!
+# ALL DOMAINS MUST BE REGISTERED FOR TARGET HOST IN DNS!
+#
+# It will normally be run like this:
+#
+#  ansible-playbook -b -i h8.waeup.org, letsencrypt.yml
+#
+- hosts: h8.waeup.org
+  vars:
+    letsencrypt_email: 'uli@gnufix.de'
+    letsencrypt_domains: 'h8.waeup.org,v2.waeup.org,v3.waeup.org,gopinkdreams.com,www.gopinkdreams.com'
+    # set to true if you got some LE certs already, but the list of domains expanded
+    letsencrypt_expand_domains: false
+  roles:
+    - letsencrypt
Index: /main/waeup-ansible/roles/letsencrypt/handlers/main.yml
===================================================================
--- /main/waeup-ansible/roles/letsencrypt/handlers/main.yml	(revision 14706)
+++ /main/waeup-ansible/roles/letsencrypt/handlers/main.yml	(revision 14706)
@@ -0,0 +1,6 @@
+---
+# handlers for letsencrypt install
+- name: "update package cache"
+  apt:
+    upgrade: "safe"
+    update_cache: yes
Index: /main/waeup-ansible/roles/letsencrypt/tasks/main.yml
===================================================================
--- /main/waeup-ansible/roles/letsencrypt/tasks/main.yml	(revision 14706)
+++ /main/waeup-ansible/roles/letsencrypt/tasks/main.yml	(revision 14706)
@@ -0,0 +1,47 @@
+---
+# tasks to enable letsencrypt on Ubuntu
+#
+# This role expects that you run `nginx` as webserver.
+# This role works on Ubuntu machines.
+# This role expects the following vars to be set:
+# - `letsencrypt_email`  Email address of cert manager
+# - `letsencrypt_domains` List of domains to maintain
+#                         comma-separated, no blanks
+# - `letsencrypt_expand_domains` - true or false
+#                         if true, new domains are added
+#                         to the already existing list of
+#                         certs
+#
+- name: "enable letsencrypt PPA"
+  become: yes
+  apt_repository:
+      repo: 'ppa:certbot/certbot'
+      state: present
+  notify: update package cache
+
+- name: "install certbot"
+  become: yes
+  apt:
+      name: certbot
+      state: present
+
+- name: "register account"
+  become: yes
+  command: certbot register -m "{{ letsencrypt_email }}" --non-interactive --agree-tos -vv
+  args:
+    creates: '/etc/letsencrypt/accounts/acme-v01.api.letsencrypt.org/directory/*/private_key.json'
+
+# For first time creation of certs. Later on use the below task or renewal
+- name: "create initial certs"
+  become: yes
+  command: certbot certonly --standalone --non-interactive -d "{{ letsencrypt_domains }}" --pre-hook "sudo service nginx stop" --post-hook "sudo service nginx start" -m "{{ letsencrypt_email }}" --agree-tos --rsa-key-size 4096
+  args:
+    creates: '/etc/letsencrypt/live/*/cert.pem'
+
+# in case additional domains must be added to the already existing ones
+- name: "create certs (expand list of domains)"
+  become: yes
+  command: certbot certonly --standalone --non-interactive -d "{{ letsencrypt_domains }}" --pre-hook "sudo service nginx stop" --post-hook "sudo service nginx start" -m "{{ letsencrypt_email }}" --agree-tos --expand --rsa-key-size 4096
+  when: letsencrypt_expand_domains
+
+# Cron task for renewal is installed automatically by the Ubuntu package
