summaryrefslogtreecommitdiff
path: root/lib/ansible/playbook/play_context.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ansible/playbook/play_context.py')
-rw-r--r--lib/ansible/playbook/play_context.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/ansible/playbook/play_context.py b/lib/ansible/playbook/play_context.py
index 355efbaf26..5b56d2515b 100644
--- a/lib/ansible/playbook/play_context.py
+++ b/lib/ansible/playbook/play_context.py
@@ -24,6 +24,7 @@ __metaclass__ = type
import pipes
import random
import re
+import tempfile
from ansible import constants as C
from ansible.errors import AnsibleError
@@ -199,6 +200,10 @@ class PlayContext(Base):
self.password = passwords.get('conn_pass','')
self.become_pass = passwords.get('become_pass','')
+ # A temporary file (opened pre-fork) used by connection
+ # plugins for inter-process locking.
+ self.connection_lockf = tempfile.TemporaryFile()
+
# set options before play to allow play to override them
if options:
self.set_options(options)
@@ -322,6 +327,11 @@ class PlayContext(Base):
return new_info
+ def copy(self, exclude_block=False):
+ new_me = super(PlayContext, self).copy()
+ new_me.connection_lockf = self.connection_lockf
+ return new_me
+
def make_become_cmd(self, cmd, executable=None):
""" helper function to create privilege escalation commands """