Playbook haproxy + let's encrypt

main
Yohann Dedy 2021-01-03 23:42:26 +01:00
commit 5a249c9e96
1 changed files with 26 additions and 0 deletions

26
concat-cert-haproxy.yml Normal file
View File

@ -0,0 +1,26 @@
- hosts: haproxy.host
environment:
DOMAIN: exemple.com
tasks:
- name: creer le dossier /etc/haproxy/certs
file:
path: /etc/haproxy/certs
state: directory
- name: concatener le certificat let's encrypt
shell: 'cat /etc/letsencrypt/live/$DOMAIN/fullchain.pem /etc/letsencrypt/live/$DOMAIN/privkey.pem'
register: cert_concat
- name: copier le certificat dans /etc/haproxy/certs
copy:
content: "{{ cert_concat.stdout }}"
dest: /etc/haproxy/certs/$DOMAIN.pem
register: cert_copied
- name: redemarrer le service haproxy
service:
name: haproxy
state: restarted
enabled: yes
when: cert_copied.changed