diff options
author | James Cammarata <jimi@sngx.net> | 2017-06-06 16:39:48 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-06 16:39:48 -0500 |
commit | 483df9c5f83befbef85796090c0f61de6436b130 (patch) | |
tree | fa4ca2141a84adda4b402725d78c9a8f9a1b9be2 /lib/ansible/executor | |
parent | 354939167360b7259386aad8e461de8f35c87236 (diff) | |
download | ansible-483df9c5f83befbef85796090c0f61de6436b130.tar.gz |
Imports and includes (#25399)
Initial commit to split includes into static imports/dynamic includes
This implements the new include/import syntax for Ansible 2.4:
* include_{tasks,role,variables} = dynamic
* import_{playbook,tasks,role} = static
The old bare `include` will be considered deprecated, as will any use of the `static: {yes|no}` option.
This also adds docs for import/include and reorganizing the "Playbook Reuse" section of the documentation.
Diffstat (limited to 'lib/ansible/executor')
-rw-r--r-- | lib/ansible/executor/task_executor.py | 4 | ||||
-rw-r--r-- | lib/ansible/executor/task_queue_manager.py | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/ansible/executor/task_executor.py b/lib/ansible/executor/task_executor.py index cc8276ec0d..7df69f48aa 100644 --- a/lib/ansible/executor/task_executor.py +++ b/lib/ansible/executor/task_executor.py @@ -432,7 +432,7 @@ class TaskExecutor: if self._loop_eval_error is not None: raise self._loop_eval_error # skip conditional exception in the case of includes as the vars needed might not be available except in the included tasks or due to tags - if self._task.action not in ['include', 'include_role']: + if self._task.action not in ['include', 'include_tasks', 'include_role']: raise # Not skipping, if we had loop error raised earlier we need to raise it now to halt the execution of this task @@ -445,7 +445,7 @@ class TaskExecutor: # if this task is a TaskInclude, we just return now with a success code so the # main thread can expand the task list for the given host - if self._task.action == 'include': + if self._task.action in ('include', 'include_tasks'): include_variables = self._task.args.copy() include_file = include_variables.pop('_raw_params', None) if not include_file: diff --git a/lib/ansible/executor/task_queue_manager.py b/lib/ansible/executor/task_queue_manager.py index 3e24853b19..f5a6886e1c 100644 --- a/lib/ansible/executor/task_queue_manager.py +++ b/lib/ansible/executor/task_queue_manager.py @@ -83,11 +83,11 @@ class TaskQueueManager: self._callback_plugins = [] self._start_at_done = False - # make sure the module path (if specified) is parsed and - # added to the module_loader object - if options.module_path is not None: - for path in options.module_path.split(os.pathsep): - module_loader.add_directory(path) + # make sure any module paths (if specified) are added to the module_loader + if isinstance(options.module_path, list): + for path in options.module_path: + if path is not None: + module_loader.add_directory(path) # a special flag to help us exit cleanly self._terminated = False |