I have a set of hosts that I can only access via openVPN (one VPN per host or group of hosts). ssh is only available after connected to the VPN.

Is there any way to automatically bring up the VPN connection for the individual hosts / host groups inside the inventory using default ansible methods?

  • 1
    That could be implement with a generic rule that would have to be called; I have no ideia if it could be implemented in the inventory phase. I know about VPN-on demand policy configurations for iOS and OS/X, would be interested to learn if something similar can be configured in Linux. In sshd_config specific connection rules can be added for each host via ProxyCommand, however it does not seem a practical approach for a high number of hosts. – Rui F Ribeiro Feb 10 '16 at 14:54
  • 1
    Interesting ideas! I didn't know about the VPN on demand option on OSX. Pity, it doesn't work with openVPN. I'll have a look at the sshd connection rules. If that doesn't pan out, I'll just have to write a wrapper script. I just don't want to reinvent the wheel. Unfortunately the problem is virtually un-google-able, always leads to playbooks for vpn installation. – leisurelarry Feb 11 '16 at 15:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.