The short answer is you don't.
Traditional network devices that dump an authenticated session to the "CLI"
effectively prevent you from being able to use OpenSSH as a programmable
transport in the way that is implemented for other systems.
WRT point #2. SSH connections being made by network
I'm trying to use the ios networking modules (ios_config, ios_template
etc.) and the only way I can get them to work properly is via connection:
local and passing the parameters to each task via something like this
- hosts: all
connection: local
gather_facts: no
tasks:
- name: define