Problem connecting to letsencrypt only from one server

Could be. Have you tried just defining it to an IP that you know works in your hosts file ? a bit messy, but would confirm that it’s related to a specific LE server and not your end. Alternatively as you’re using a script - can you just define the IP instead of using acme-staging.api.letsencrypt.org as a test.