From 5bb0f6908bedd2a8096eb63271d2a25505f5dd5f Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Mon, 17 Sep 2012 18:28:37 +0200 Subject: [PATCH] Allow transport on tasks, and use it for local_action --- lib/ansible/playbook/__init__.py | 2 +- lib/ansible/playbook/task.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/ansible/playbook/__init__.py b/lib/ansible/playbook/__init__.py index d461c35ab5..59ce9c2e70 100644 --- a/lib/ansible/playbook/__init__.py +++ b/lib/ansible/playbook/__init__.py @@ -223,7 +223,7 @@ class PlayBook(object): setup_cache=self.SETUP_CACHE, basedir=task.play.basedir, conditional=task.only_if, callbacks=self.runner_callbacks, sudo=task.play.sudo, sudo_user=task.play.sudo_user, - transport=task.play.transport, sudo_pass=self.sudo_pass, is_playbook=True + transport=task.transport, sudo_pass=self.sudo_pass, is_playbook=True ) if task.async_seconds == 0: diff --git a/lib/ansible/playbook/task.py b/lib/ansible/playbook/task.py index 09d5446a13..55d5a80ceb 100644 --- a/lib/ansible/playbook/task.py +++ b/lib/ansible/playbook/task.py @@ -26,14 +26,14 @@ class Task(object): 'notify', 'module_name', 'module_args', 'module_vars', 'play', 'notified_by', 'tags', 'register', 'with_items', 'delegate_to', 'first_available_file', 'ignore_errors', - 'local_action' + 'local_action', 'transport' ] # to prevent typos and such VALID_KEYS = [ 'name', 'action', 'only_if', 'async', 'poll', 'notify', 'with_items', 'first_available_file', 'include', 'tags', 'register', 'ignore_errors', - 'delegate_to', 'local_action' + 'delegate_to', 'local_action', 'transport' ] def __init__(self, play, ds, module_vars=None): @@ -60,10 +60,11 @@ class Task(object): # Only one of them is defined elif 'local_action' in ds: self.action = ds.get('local_action', '') - self.delegate_to = '127.0.0.1' + self.transport = 'local' else: self.action = ds.get('action', '') self.delegate_to = ds.get('delegate_to', None) + self.transport = ds.get('transport', play.transport) # notified by is used by Playbook code to flag which hosts # need to run a notifier