@@ -92,6 +92,12 @@ def configure(self, parser):
9292 help = 'When using Shell Control Box (SCB) and creating a proxy,'
9393 'a random port is generated, which will be used in the ssh config '
9494 'for all playbook, run and sync operations' )
95+ parser .add_argument (
96+ '--ssh-dest-user' ,
97+ type = str ,
98+ dest = 'ssh_dest_user' ,
99+ help = 'SSH User for the destination host, different from the bastion or SCB user. '
100+ 'Useful when LDAP is not working on the destination host.' )
95101
96102 def get_help (self ):
97103 return 'SSH or create an SSH tunnel to a server in the cluster'
@@ -260,6 +266,12 @@ def run(self, args, extra_args):
260266 ssh_config = args .ssh_config or self .ops_config .get (
261267 'ssh.config' ) or self .ansible_inventory .get_ssh_config ()
262268
269+ ssh_host_bastion , ssh_host_dest = None , None
270+ if args .ssh_dest_user :
271+ ssh_host_parts = ssh_host .split ('--' )
272+ ssh_host_bastion = ssh_host_parts [0 ]
273+ ssh_host_dest = ssh_host_parts [1 ] if len (ssh_host_parts ) > 1 else None
274+
263275 scb_ssh_host = None
264276 if scb_enabled :
265277 # scb->bastion->host vs scb->bastion
@@ -280,8 +292,14 @@ def run(self, args, extra_args):
280292 else :
281293 if scb_enabled :
282294 command = f"ssh -F { ssh_config } { ssh_user } @{ scb_ssh_host } "
295+ if args .ssh_dest_user and ssh_host_dest :
296+ command = (f"ssh -F { ssh_config } -t { ssh_user } @{ ssh_host_bastion } @{ scb_host } "
297+ f"ssh { args .ssh_dest_user } @{ ssh_host_dest } " )
283298 else :
284299 command = f"ssh -F { ssh_config } { ssh_host } "
300+ if args .ssh_dest_user and ssh_host_dest :
301+ command = (f"ssh -F { ssh_config } -t { ssh_user } @{ ssh_host_bastion } "
302+ f"ssh { args .ssh_dest_user } @{ ssh_host_dest } " )
285303
286304 if args .proxy :
287305 if scb_enabled :
0 commit comments