Configure ssh bastion host for many connections.

If we where to run a Ansible Playbook on a lot of Machines via a Bastion Host we can encounter a problem where some SSH connections fail, this is caused by the default configuration of the sshd daemon regarding parallel sessions.

To work around this issue we must alter the sshd configuration on our bastion host to allow more then the default 10 parallel SSH Sessions/Connections.

For this purpose we add the following configuration to the /etc/ssh/sshd_config on the bastion Host.

MaxSessions 50
MaxStartups 50:30:80

The MaxSessions option specifies the maximum number of open shell, login or subsystem (e.g. sftp) sessions permitted per network connection. And is increased to allow for better Multiplexing.

The MaxStartups option specifies the maximum number of concurrent unauthenticated connections to the SSH daemon. Leaving this on its default vaue is the main cause of connection problems with big inventories.

With this configuration in place you should be able to open up, up to ~50 parallel Sessions at the same time, and therefor can work with big inventories without SSH connection problems.