SSH Access to the Remote servers

Hi Ansible Community,

I have been trying to configure the ssh.cfg and ansible.cfg to be able to access using an id_rsa to connect via ssh to the remote servers. The question comes when I try to configure these 2 config files. Any main steps that are needed to take to make it work?

Files:

  • ssh.cfg
  • ansible.cfg

I am also checking my AWS rules as it could be a rule blocking ssh external access.

Thanks a lot,
Kind regards,
Guille

Hi Guille,

I have been trying to configure the ssh.cfg and ansible.cfg to be able to
access using an id_rsa to connect via ssh to the remote servers. The
question comes when I try to configure these 2 config files. Any main steps
that are needed to take to make it work?

Files:

- ssh.cfg

I guess you are talking about the ssh_config file. Since Ansible uses
the systems ssh client (OpenSSH most likely), the config file for ssh
has to be in a location OpenSSH is looking for it.

On Linux that'd be /etc/ssh/ssh_config for the system-wide config or
$HOME/.ssh/config for a single users config.

The $HOME/.ssh directory has to have 700 or rwx------ permissions.

In there you just specify

Host myhost.example.com
  IdentityFile /path/to/your/private/key

Afterwards the first thing you should check is, if normal ssh works as
expected.

- ansible.cfg

You should not need to specify anything here. If you need to keep your
ssh_config in a location the systems SSH client wouldn't look for it,
you probably could add a

-F /path/to/your/ssh/config

to the ssh_args parameter.

HTH
Sebastian