library/roles/haproxy/tasks: Fix to the letsencrypt hooks handling.

library/roles/letsencrypt-acmetool-client/tasks: Do not fail if the quickstart does not succeed. The web service could be not configured yet.
This commit is contained in:
Andrea Dell'Amico 2016-04-16 18:48:54 +02:00
parent bb862c8405
commit 8fde6bb113
5 changed files with 46 additions and 27 deletions

View File

@ -0,0 +1,8 @@
---
- name: Install a script that fix the letsencrypt certificate for haproxy and then reload the service
copy: src=haproxy-letsencrypt-acme.sh dest={{ letsencrypt_acme_services_scripts_dir }}/haproxy owner=root group=root mode=4555
when:
- haproxy_letsencrypt_managed
- letsencrypt_acme_install
tags: [ 'haproxy', 'letsencrypt' ]

View File

@ -5,11 +5,3 @@
- haproxy_letsencrypt_managed
- letsencrypt_install
tags: [ 'haproxy', 'letsencrypt' ]
- name: Install a script that fix the letsencrypt certificate for haproxy and then reload the service
copy: src=haproxy-letsencrypt-acme.sh dest={{ letsencrypt_acme_services_scripts_dir }}/haproxy owner=root group=root mode=4550
when:
- haproxy_letsencrypt_managed
- letsencrypt_acme_install
tags: [ 'haproxy', 'letsencrypt' ]

View File

@ -1,4 +1,10 @@
---
- include: haproxy-service.yml
- include: haproxy-letsencrypt.yml
when: haproxy_letsencrypt_managed
when:
- haproxy_letsencrypt_managed
- letsencrypt_install is defined
- include: haproxy-letsencrypt-acmetool.yml
when:
- haproxy_letsencrypt_managed
- letsencrypt_acme_install is defined

View File

@ -0,0 +1,9 @@
---
- name: Initialize letsencrypt acmetool
become: True
become_user: '{{ letsencrypt_acme_user }}'
command: '{{ letsencrypt_acme_command }} {{ letsencrypt_acme_command_opts }} quickstart ; {{ letsencrypt_acme_command }} {{ letsencrypt_acme_command_opts }} reconcile'
args:
creates: '{{ letsencrypt_acme_user_home }}/accounts'
when: letsencrypt_acme_install

View File

@ -4,6 +4,7 @@
when:
- letsencrypt_acme_install
- is_ubuntu
notify: Initialize letsencrypt acmetool
tags: letsencrypt
- name: Install the letsencrypt acmetool repo key on debian
@ -18,6 +19,7 @@
when:
- letsencrypt_acme_install
- is_debian
notify: Initialize letsencrypt acmetool
tags: letsencrypt
- name: Create the letsencrytp acme user
@ -82,24 +84,6 @@
- "'{{ letsencrypt_acme_authenticator }}' != 'listener'"
tags: letsencrypt
- name: letsencrypt acmetool initializaztion
become: True
become_user: '{{ letsencrypt_acme_user }}'
command: '{{ letsencrypt_acme_command }} {{ letsencrypt_acme_command_opts }} quickstart'
args:
creates: '{{ letsencrypt_acme_user_home }}/accounts'
when: letsencrypt_acme_install
tags: letsencrypt
- name: letsencrypt acmetool request the first certificate
become: True
become_user: '{{ letsencrypt_acme_user }}'
command: '{{ letsencrypt_acme_command }} {{ letsencrypt_acme_command_opts }} reconcile'
args:
creates: '{{ letsencrypt_acme_certs_dir }}/cert'
when: letsencrypt_acme_install
tags: letsencrypt
- name: Install the sudoers config needed to run the acmetool hooks
template: src=acme-sudoers.j2 dest=/etc/sudoers.d/letsencrypt-acme owner=root group=root mode=0440
when: letsencrypt_acme_install
@ -110,3 +94,23 @@
when: letsencrypt_acme_install
tags: letsencrypt
- name: letsencrypt acmetool initializaztion
become: True
become_user: '{{ letsencrypt_acme_user }}'
command: '{{ letsencrypt_acme_command }} {{ letsencrypt_acme_command_opts }} quickstart'
args:
creates: '{{ letsencrypt_acme_user_home }}/accounts'
when: letsencrypt_acme_install
ignore_errors: True
tags: letsencrypt
- name: letsencrypt acmetool request the first certificate
become: True
become_user: '{{ letsencrypt_acme_user }}'
command: '{{ letsencrypt_acme_command }} {{ letsencrypt_acme_command_opts }} reconcile'
args:
creates: '{{ letsencrypt_acme_certs_dir }}/cert'
when: letsencrypt_acme_install
ignore_errors: True
tags: letsencrypt