I’m deploying an Ansible control node to Azure using Terraform. I need to add/register an existing SSH key on this VM, so that Ansible can communicate to other remote VMs (managed nodes) over SSH.
I know how to configure SSH access to the VM (using Terraform), but what I need is to set up SSH on the Ansible control node VM so that it can access other managed node VMs. i.e. I need a private SSH key saved to ~/.ssh/id_rsa
The (base64 encoded) private SSH key can be passed to Terraform, but I’m not sure how to add/register this on the VM aside from using a remote-exec
provisioner with an inline script… I’m thinking there must be a better way to do this…