diff --git a/salt/cloud/clouds/saltify.py b/salt/cloud/clouds/saltify.py index dbe56260b2..00398c14e8 100644 --- a/salt/cloud/clouds/saltify.py +++ b/salt/cloud/clouds/saltify.py @@ -133,6 +133,9 @@ def create(vm_): 'display_ssh_output', vm_, __opts__, default=True ) } + if 'ssh_port' in vm_: + deploy_kwargs.update({'port': vm_['ssh_port']}) + # forward any info about possible ssh gateway to deploy script # as some providers need also a 'gateway' configuration if 'gateway' in vm_: diff --git a/salt/utils/cloud.py b/salt/utils/cloud.py index e8ef29a26c..8395d9b271 100644 --- a/salt/utils/cloud.py +++ b/salt/utils/cloud.py @@ -1387,6 +1387,9 @@ def scp_file(dest_path, contents, kwargs): '-i {0}'.format(kwargs['key_filename']) ]) + if 'port' in kwargs: + ssh_args.extend(['-P {0}'.format(kwargs['port'])]) + if 'ssh_gateway' in kwargs: ssh_gateway = kwargs['ssh_gateway'] ssh_gateway_port = 22 @@ -1562,6 +1565,10 @@ def root_cmd(command, tty, sudo, **kwargs): ssh_gateway_user, ssh_gateway, ssh_gateway_port ) ) + + if 'port' in kwargs: + ssh_args.extend(['-p {0}'.format(kwargs['port'])]) + cmd = 'ssh {0} {1[username]}@{1[hostname]} {2}'.format( ' '.join(ssh_args), kwargs, pipes.quote(command) )