On Azure I've got a resource group with 1 vnet containing 2 servers; master and worker. Only master has a public IP.

Using "plain" ansible I can manage both servers by defining worker's private IP as ansible_host in the hosts file and creating a group_vars file with a ssh ProxyCommand arguments to apply for worker's group as described for a jump host here (note there are older methods too which involve direct ssh config but the group_vars approach is preferable I think as it is more portable to other users).

However this approach needs IPs to be hardcoded which isn't great on azure. There's an azure_rm script or plugin (depending on ansible version) which will provide dynamic inventory avoiding the need for a hosts file but how I can I do the equivalent of the ProxyCommand setup in this case?

This situation must be pretty common so I feel like I must be missing something.

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.