From d5db8e937e099a117061f50fdf0c0aab95e60acc Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Wed, 17 Oct 2012 22:50:17 -0400 Subject: [PATCH] Fix port overrides such that with fireball mode you don't have to specify an explicit port. --- lib/ansible/playbook/__init__.py | 2 +- lib/ansible/runner/__init__.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ansible/playbook/__init__.py b/lib/ansible/playbook/__init__.py index 94409ca7f8..69116d1e8b 100644 --- a/lib/ansible/playbook/__init__.py +++ b/lib/ansible/playbook/__init__.py @@ -51,7 +51,7 @@ class PlayBook(object): remote_user = C.DEFAULT_REMOTE_USER, remote_pass = C.DEFAULT_REMOTE_PASS, sudo_pass = C.DEFAULT_SUDO_PASS, - remote_port = C.DEFAULT_REMOTE_PORT, + remote_port = None, transport = C.DEFAULT_TRANSPORT, private_key_file = C.DEFAULT_PRIVATE_KEY_FILE, callbacks = None, diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index 023aa779fd..07e8a001bd 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -382,7 +382,9 @@ class Runner(object): conn = None actual_host = inject.get('ansible_ssh_host', host) - actual_port = inject.get('ansible_ssh_port', port) + actual_port = port + if self.transport in ['paramiko', 'ssh' ]: + actual_port = inject.get('ansible_ssh_port', port) # the delegated host may have different SSH port configured, etc # and we need to transfer those, and only those, variables