ansible-role-certbot/tasks/certificates.yml

29 lines
986 B
YAML
Raw Normal View History

2018-06-10 19:34:06 +02:00
- name: check if certificate exist
stat:
2018-07-07 19:24:56 +02:00
path: '/etc/letsencrypt/live/{{ item.name }}'
2018-11-25 20:24:19 +01:00
loop: '{{ certbot_domains }}'
2018-06-10 19:34:06 +02:00
register: st
tags: certbot
- name: check if nginx is launch
stat:
path: /var/run/nginx.pid
register: ng
tags: certbot
- name: create a new certificate
2018-11-26 18:12:43 +01:00
command: >
certbot certonly -n --agree-tos -d {{ item.item.name }} -m {{ certbot_mail }}
--webroot --webroot-path {{ certbot_path }} --rsa-key-size {{ certbot_key_size }}
2018-11-25 20:24:19 +01:00
loop: '{{ st.results }}'
2018-07-07 19:24:56 +02:00
when: (certbot_role == 'master' or item.item.name == ansible_fqdn) and not item.stat.exists and ng.stat.exists
2018-06-10 19:34:06 +02:00
tags: certbot
- name: create a new certificate (standalone)
2018-11-26 18:12:43 +01:00
command: >
certbot certonly -n --agree-tos -d {{ item.item.name }} -m {{ certbot_mail }}
--standalone --rsa-key-size {{ certbot_key_size }}
2018-11-25 20:24:19 +01:00
loop: '{{ st.results }}'
2018-07-07 19:24:56 +02:00
when: (certbot_role == 'master' or item.item.name == ansible_fqdn) and not item.stat.exists and not ng.stat.exists
2018-06-10 19:34:06 +02:00
tags: certbot