An Ansible playbook to set up a bunch of reverse proxies with a shared letsencrypt certificate
-> EXPERIMENTAL
This is mostly obsolete because the new ACMEv2 API supports DNS challenges, that make it a lot easier to get and distribute ssl certificates from let's encrypt
-
ansible on your local host
-
one blank controller server
-
some blank proxy servers
-
a domain pointing to your controller server eg.
ctrl.example.com
-
a domain pointing to your distribution consisting of all your reverse proxies eg.
www.example.com
-
an
inventory
file with content like this:[controller] x.x.x.x [proxies] y.y.y.y proxy_number=1 z.z.z.z proxy_number=2
- run
ansible-playbook -i inventory playbook.yml
- ssh into the controller
- run
./init_proxies.sh
- you should be fine to go now
- ssh into the controller
- run
./update_proxies.sh
-
ssh hostkeys: for now we dont automatically trust new ssh host keys after the initial setup. workaround:
- ssh into all new proxy servers from your machine before starting
- ssh into all new proxy server from the controller before running
./init_proxies.sh
or - run
./trust_hosts.sh y.y.y.y z.z.z.z
from your machine before starting - run
./trust_hosts.sh y.y.y.y z.z.z.z
from the controller before running./init_proxies.sh
-
adding new proxies: this is currently untested:
- theoretically updating the
inventory
file, re-deploying the 'stage-2' playbook and executing./update_proxies
on the controller should work
- theoretically updating the
- handle multiple domains (nginx config and letsencrypt)
- automated tests?
- test adding another proxy after the initial setup
- automate certificate renewal with a cronjob
I am not responsible for damages to your soft- or hardware or bugs eating your cat that occur through usage of this code or part of it.