Step zero: Install this role by creating the directories roles/letsencrypt/, roles/letsencrypt/files/ and roles/letsencrypt/tasks/. Then save the tasks.yml from this gist as roles/letsencrypt/tasks/main.yml and config.sh from this gist as roles/letsencrypt/files/config.sh.
Step one: Add the following to your nginx server config
location /.well-known/acme-challenge {
root /var/www/letsencrypt;
}
Step two: Execute the ansible role, e.g. using