Skip to content

Instantly share code, notes, and snippets.

diff --git a/lib/ansible/plugins/strategy/__init__.py b/lib/ansible/plugins/strategy/__init__.py
index cd4050d8db..ee2cca5695 100644
--- a/lib/ansible/plugins/strategy/__init__.py
+++ b/lib/ansible/plugins/strategy/__init__.py
@@ -875,15 +875,23 @@ class StrategyBase:
host_results = []
for host in notified_hosts:
if not iterator.is_failed(host) or play_context.force_handlers:
- task_vars = self._variable_manager.get_vars(play=iterator._play, host=host, task=handler)
- self.add_tqm_variables(task_vars, play=iterator._play)
diff --git a/lib/ansible/executor/task_executor.py b/lib/ansible/executor/task_executor.py
index 5782c93c83..b887f6c8a8 100644
--- a/lib/ansible/executor/task_executor.py
+++ b/lib/ansible/executor/task_executor.py
@@ -420,6 +420,7 @@ class TaskExecutor:
}
if self._connection.become:
clear_plugins['become'] = self._connection.become._load_name
+ self._connection.become.prompt = ''
@mkrizek
mkrizek / diff.diff
Last active December 4, 2019 14:58
65365
commit 960e971b01a8493d40245a9cdb018b4d1ad13c33 (HEAD -> issue-65365)
Author: Martin Krizek <[email protected]>
Date: Wed Dec 4 15:55:52 2019 +0100
Set HostVars._variable_manager's attrs
When HostVars are part of the data that goes through (de)serialization
when being passed from a worker process to the main process, its
variable manager reference loses some of its attributes due to the
implementation of __getstate__ and __setstate__ (perf utilization).
diff --git a/migrate.py b/migrate.py
index 014b90c..fed8256 100755
--- a/migrate.py
+++ b/migrate.py
@@ -119,7 +119,7 @@ REWRITE_CLASS_PROPERTY_PLUGINS= {
VARDIR = os.environ.get('GRAVITY_VAR_DIR', '.cache')
LOGFILE = os.path.join(VARDIR, 'errors.log')
-REMOVE = set()
+REMOVE = defaultdict(lambda: defaultdict(set))
@mkrizek
mkrizek / ansible-jinja-types.md
Last active January 15, 2025 20:33
Ansible, Jinja2 and Types

Ansible, Jinja2 and Types

Strings, strings everywhere

Jinja2 is a templating engine and as such its primary use case is to render templates into text; which is usually HTML output saved into text file.

Consider the following Ansible play that uses Jinja2 templates to evaluate expressions:

- hosts: localhost
  gather_facts: no
terraform {
required_providers {
{{ tf_provider['name'] }} = {
source = "{{ tf_provider['source'] }}"
version = "{{ tf_provider['version'] }}"
}
}
}
diff --git a/lib/ansible/executor/play_iterator.py b/lib/ansible/executor/play_iterator.py
index 51799cc7a4e..c9712500249 100644
--- a/lib/ansible/executor/play_iterator.py
+++ b/lib/ansible/executor/play_iterator.py
@@ -21,7 +21,6 @@ __metaclass__ = type
import fnmatch
-from collections import deque
from enum import IntEnum, IntFlag