I have installed Foreman 2.1 and want to use Ansible roles on the servers that are created by Foreman (CentOS 8 VMs and bare metal).
It is not clear to me how to setup the servers so that I can use Ansible roles without root’s ssh key. Is there a best practice or some outlines as to how to prepare the new hosts and Foreman such that Ansible roles can be executed as a user with sudo privileges?
I’ve installed the foreman-proxy SSH key during the VM creation in the kickstart file.
Just to add this information here:
I used the remote_execution snipped, there you can set the user you want to create with parameters.
Have a look here: https://github.com/theforeman/foreman/blob/fc542d3d3414af9bf191f7bb1c6acd282d601a57/app/views/unattended/provisioning_templates/snippet/remote_execution_ssh_keys.erb