Skip to content

Commit be48417

Browse files
author
Lev Goncharov
committed
molecule uses ANSIBLE_FILTER_PLUGINS
1 parent 14dc007 commit be48417

File tree

1 file changed

+33
-28
lines changed

1 file changed

+33
-28
lines changed

src/molecule/provisioner/ansible.py

+33-28
Original file line numberDiff line numberDiff line change
@@ -507,41 +507,46 @@ def default_env(self):
507507
list(map(util.abs_path, os.environ["ANSIBLE_ROLES_PATH"].split(":"))),
508508
)
509509

510+
filter_plugins_path_list = [
511+
self._get_filter_plugin_directory(),
512+
util.abs_path(
513+
os.path.join(
514+
self._config.scenario.ephemeral_directory,
515+
"plugins",
516+
"filter",
517+
),
518+
),
519+
util.abs_path(
520+
os.path.join(
521+
self._config.project_directory,
522+
"plugins",
523+
"filter",
524+
),
525+
),
526+
util.abs_path(
527+
os.path.join(
528+
os.path.expanduser("~"),
529+
".ansible",
530+
"plugins",
531+
"filter",
532+
),
533+
),
534+
"/usr/share/ansible/plugins/filter",
535+
]
536+
if os.environ.get("ANSIBLE_FILTER_PLUGINS", ""):
537+
filter_plugins_path_list.extend(
538+
list(map(util.abs_path, os.environ["ANSIBLE_FILTER_PLUGINS"].split(":"))),
539+
)
540+
541+
510542
env = util.merge_dicts(
511543
os.environ,
512544
{
513545
"ANSIBLE_CONFIG": self._config.provisioner.config_file,
514546
"ANSIBLE_ROLES_PATH": ":".join(roles_path_list),
515547
self._config.ansible_collections_path: ":".join(collections_path_list),
516548
"ANSIBLE_LIBRARY": ":".join(self._get_modules_directories()),
517-
"ANSIBLE_FILTER_PLUGINS": ":".join(
518-
[
519-
self._get_filter_plugin_directory(),
520-
util.abs_path(
521-
os.path.join(
522-
self._config.scenario.ephemeral_directory,
523-
"plugins",
524-
"filter",
525-
),
526-
),
527-
util.abs_path(
528-
os.path.join(
529-
self._config.project_directory,
530-
"plugins",
531-
"filter",
532-
),
533-
),
534-
util.abs_path(
535-
os.path.join(
536-
os.path.expanduser("~"),
537-
".ansible",
538-
"plugins",
539-
"filter",
540-
),
541-
),
542-
"/usr/share/ansible/plugins/filter",
543-
],
544-
),
549+
"ANSIBLE_FILTER_PLUGINS": ":".join(filter_plugins_path_list),
545550
},
546551
)
547552
env = util.merge_dicts(env, self._config.env)

0 commit comments

Comments
 (0)