You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
|
- name: Install certbot base
|
|
|
|
|
|
apt:
|
|
|
|
|
|
name:
|
|
|
|
|
|
- certbot
|
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
|
|
- name : Install Let's Encrypt Package
|
|
|
|
|
|
apt: name={{ certbot_package }} update_cache=yes state=latest
|
|
|
|
|
|
|
|
|
|
|
|
- name: check if pem already exists
|
|
|
|
|
|
stat:
|
|
|
|
|
|
path: "/etc/letsencrypt/live/{{ certbot_site_names['host1'] }}/fullchain.pem"
|
|
|
|
|
|
register: pem
|
|
|
|
|
|
|
|
|
|
|
|
- debug:
|
|
|
|
|
|
msg: "it looks like the let's encrypt pem exists..."
|
|
|
|
|
|
when: pem.stat.exists
|
|
|
|
|
|
|
|
|
|
|
|
- debug:
|
|
|
|
|
|
msg: "it looks like the let's encrypt pem does not exist..."
|
|
|
|
|
|
when: not pem.stat.exists
|
|
|
|
|
|
|
|
|
|
|
|
- name: Create and Install certificates using {{ certbot_plugin }} Plugin
|
|
|
|
|
|
shell: certbot --{{ certbot_plugin }} -d {{ item }} -m {{ certbot_mail_address }} --agree-tos --noninteractive --redirect
|
|
|
|
|
|
when: not pem.stat.exists
|
|
|
|
|
|
with_items:
|
|
|
|
|
|
- "{{ certbot_site_names['host1'] }}"
|
|
|
|
|
|
# TODO: in case of multi-site
|
|
|
|
|
|
#- "{{ certbot_site_names['host2'] }}"
|
|
|
|
|
|
|
|
|
|
|
|
- name: Set Letsencrypt Cronjob for Certificate Auto Renewal
|
|
|
|
|
|
cron: name=letsencrypt_renewal special_time=monthly job="/usr/bin/certbot renew"
|
|
|
|
|
|
tags:
|
|
|
|
|
|
- cert_renew
|