Closed anzoman closed 4 years ago
Thank you for the issue description, @anzoman. I feel that implementing your suggestion can be useful in some scenarios, where all the hosts to be managed will allow connections using the corresponding public SSH key.
Given that the environment will contain the path to the private key, I suggest that the env variable is either OPERA_SSH_PRIVATE_KEY_FILE
or, if this is too long, OPERA_SSH_IDENTITY_FILE
.
A few questions:
@matejart thanks for your opinion OPERA_SSH_IDENTITY_FILE
seems to be a good decision for the name. And to answer your questions:
We are dunzo here! Since this was successfully implemented with #61 we can close this issue.
Description
xOpera orchestrator currently offers
OPERA_SSH_USER
environment variable which is used by the Ansible executor when establishing the connection to a remote machine to tell which user someone wants to connect as. Similar to that there could be a variable calledOPERA_SSH_KEY_FILE
that would point to the file with a private ssh key that needs to be used when establishing a connection to the host.Steps
As of now before deploying TOSCA templates opera creates an Ansible inventory in the background and sets the user within
ansible_user
entry ifOPERA_SSH_USER
was exported. Exactly this is done with the line:inventory["ansible_user"] = os.environ.get("OPERA_SSH_USER", "centos")
so that user defaults to centos if this was not set to localhost before.To implement the part for the ssh keys we would need to:
OPERA_SSH_KEY_FILE
env var to point opera to the ssh keyansible_ssh_private_key_file
entryCurrent behaviour
Currently xOpera does not offer to choose ssh keys to connect but it expects that user managed that before by himself either with putting keys to the
~/.ssh
folder or by creating~/.ssh/config
configuration file which offers matching IPs and ssh keys for connection.Expected results
To be able to specify which ssh keys to use during the orchestration.