infra/ansible/roles/lego/templates/lego_reload.sh.j2

15 lines
347 B
Text
Raw Normal View History

#!/bin/bash
2021-01-23 21:23:06 +00:00
export SOURCE_PEM=/etc/lego/certificates/{{ item.name }}.pem
export DEST_PEM=/etc/haproxy/certs/{{ item.name }}.pem
if [ -e ${DEST_PEM} ]; then
2021-01-23 21:23:06 +00:00
diff ${SOURCE_PEM} ${DEST_PEM}
diff_rc=$?
if [ ${diff_rc} == 0 ]; then
exit
fi
cp ${SOURCE_PEM} ${DEST_PEM}
chown haproxy:haproxy ${DEST_PEM}
systemctl reload haproxy
fi