Example of Remote SSH Application
This example shows how to connect to a remote SSH Server with Ansible. Ansible combined with Harmony Connect Application-Level is a powerful tool for automating access to remote servers.
To connect to any server through Harmony Connect, you can append a new host entry to the inventory file /etc/ansible/hosts
in one of the ways below:
myhost ansible_host=${SSH_HOST_FROM_USER_PORTAL} ansible_user=${SSH_USERNAME_FROM_USER_PORTAL} ansible_ssh_private_key_file=${SSH_USER_PRIVATE_KEY_FROM_USER_PORTAL}
The parameters are as shown in the app portal:
-
SSH_HOST_FROM_USER_PORTAL=Host
-
SSH_USER_PRIVATE_KEY_FROM_USER_PORTAL=Private Key
-
SSH_USERNAME_FROM_USER_PORTAL=Username (the application name)
Private key usage can be one of these:
-
by the "
ansible_ssh_private_key_file
" parameter in the inventory file per server defined -
by adding it to the SSH agent keys with the "
ssh-add -K
" command