Ansible setup password-less ssh relay access
Set up password-less access from the accessing_host! to
accessed_host using accessed_user. The used
SSH key must be stored at ~/.ssh/{{ relay_ssh_key_name }}
The authorized key is only usable to create port forwards and does not
allow interactive sessions.
Variables
NOTE: all used variables are prefixed with the role name to prevent scoping issues.
ssh_relay_accessing_host [inventory_hostname]: the host initiating the port forwardssh_relay_accessed_host: the server connected to to establish the port forwardssh_relay_accessed_user: the user on the server to connect torelay_ssh_key_name: The name of the private key of the relay SSH key pair
Requirements
- The private key for the relay host must be accessable:
~/.ssh/{{ relay_ssh_key_name }} relay_hostmust be configurable with ansible
Example Playbook
---
- hosts: host-pattern
roles:
- ssh_relay_access # use default variable values
- role: ssh_relay_access # explicitly pass vales
ssh_relay_accessed_host: foo.tld
ssh_relay_accessed_user: alice
ssh_relay_accessing_host: bar.tldLicense
This ansible role is licensed under the term of the GPLv3. For
further information see the COPYING file or https://www.gnu.org/licenses/gpl-3.0.en.html.
