Skip to content

Instantly share code, notes, and snippets.

@mgedmin
Last active May 30, 2016 12:25
Show Gist options
  • Save mgedmin/c510afe3a12e669fcab831db9b73bf4b to your computer and use it in GitHub Desktop.
Save mgedmin/c510afe3a12e669fcab831db9b73bf4b to your computer and use it in GitHub Desktop.
## hostvars:
letsencrypt_certs:
- demo.ubuntu.lt
- ubuntu.lt, www.ubuntu.lt
- legacy.ubuntu.lt
## my letsencrypt role's main/tasks.yml:
- name: generate certificates
command: >
/opt/letsencrypt/bin/certbot certonly
{% if letsencrypt_dry_run %}
--dry-run
{% endif %}
--text
--noninteractive
--agree-tos
--email "{{ letsencrypt_email }}"
--authenticator apache
{% if item is string %}
--domain "{{ item }}"
{% else %}
{% for domain in item %}
--domain "{{ domain }}"
{% endfor %}
{% endif %}
creates=/etc/letsencrypt/live/{{ item.split(',')[0] if item is string else item[0] }}
with_items:
- "{{ letsencrypt_certs }}"
tags: [ letsencrypt, certs ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment