I am trying to connect to 2 hosts from 2 different ProxyJumpHost.
For example: hostname1 is reachable only via ProxyJumpHost1 hostname2 is reachable only via ProxyJumpHost2
when I give "ansible_ssh_common_args" variable separately for the group but ansible is picking only one ProxyJumpHost information and trying to connect both the hosts from there.
My inventory yaml file looks like this
all_nodes:
children:
preprod:
children:
PRE_CH:
vars:
ansible_ssh_common_args: '-o ProxyCommand="sshpass -p {{ password }} ssh -W %h:%p -q {{ user }}@<ProxyJumpHost1>"'
hosts:
hostname1:
ansible_host: <IP_Address>
hostname2:
ansible_host: <IP_Address>
PRE_NL:
vars:
ansible_ssh_common_args: '-o ProxyCommand="sshpass -p {{ password }} ssh -W %h:%p -q {{ user }}@<ProxyJumpHost1>"'
hosts:
hostname3:
ansible_host: <IP_Address>
hostname4:
ansible_host: <IP_Address>
My expectation is to connect the correct host via correct ProxyJumpHost.
But actually it takes only one ProxyJumpHost value and tries to connect all the hosts via that.