From 1ed57f1f642315669fa4b7653193d29ad9a9b585 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 12 Sep 2018 15:35:04 -0400 Subject: [PATCH] moving from with_ff to just ff (#44847) --- lib/ansible/modules/utilities/logic/include_vars.py | 11 ++++++----- lib/ansible/plugins/lookup/filetree.py | 2 +- lib/ansible/plugins/lookup/first_found.py | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/ansible/modules/utilities/logic/include_vars.py b/lib/ansible/modules/utilities/logic/include_vars.py index 9dd2f7217b2..9fea894369f 100644 --- a/lib/ansible/modules/utilities/logic/include_vars.py +++ b/lib/ansible/modules/utilities/logic/include_vars.py @@ -85,11 +85,12 @@ EXAMPLES = """ when: x == 0 - name: Load a variable file based on the OS type, or a default if not found. Using free-form to specify the file. - include_vars: "{{ item }}" - with_first_found: - - "{{ ansible_distribution }}.yaml" - - "{{ ansible_os_family }}.yaml" - - default.yaml + include_vars: "{{ lookup('first_found', possible_files) }}" + vars: + possible_files: + - "{{ ansible_distribution }}.yaml" + - "{{ ansible_os_family }}.yaml" + - default.yaml - name: Bare include (free-form) include_vars: myvars.yaml diff --git a/lib/ansible/plugins/lookup/filetree.py b/lib/ansible/plugins/lookup/filetree.py index 527e9e34a49..3ea0cc5f091 100644 --- a/lib/ansible/plugins/lookup/filetree.py +++ b/lib/ansible/plugins/lookup/filetree.py @@ -12,7 +12,7 @@ short_description: recursively match all files in a directory tree description: - This lookup enables you to template a complete tree of files on a target system while retaining permissions and ownership. - Supports directories, files and symlinks, including SELinux and other file properties -- If you provide more than one path, it will implement a with_first_found logic, and will not process entries it already processed in previous paths. +- If you provide more than one path, it will implement a first_found logic, and will not process entries it already processed in previous paths. This enables merging different trees in order of importance, or add role_vars to specific paths to influence different instances of the same role. options: _terms: diff --git a/lib/ansible/plugins/lookup/first_found.py b/lib/ansible/plugins/lookup/first_found.py index 06bb2d105d8..0c229512029 100644 --- a/lib/ansible/plugins/lookup/first_found.py +++ b/lib/ansible/plugins/lookup/first_found.py @@ -150,5 +150,5 @@ class LookupModule(LookupBase): return [path] if skip: return [] - raise AnsibleLookupError("No file was found when using with_first_found. Use the 'skip: true' option to allow this task to be skipped if no " + raise AnsibleLookupError("No file was found when using first_found. Use the 'skip: true' option to allow this task to be skipped if no " "files are found")