I'm looking to add github to known_hosts for the deploy user when the command is ran by the root user.
The command would be :
ssh -T -o "StrictHostKeyChecking no" git@github.com
Using cloudinit, it runs initially with the root user, so this command in the cloudinit script will only allow the root user.
This is not tied cloudinit specifically, but is there a way/option to specify which user is running a specific ssh command ?