Replace with_first_found with lookup first_found
The with_ directives are discouraged now in place of use of loop: and/or lookup filters. In the case of with_first_found, it confuses people because with_ directives are usually a loop, but in this case it's the task is always executed once. Using the first_found filter makes it clearer that this is occuring. While we're in there, remove uses of 'static: no'. Since 2.0 includes are dynamic by default, so these are not necessary. Change-Id: Ie429d7614b2f3322a646f46a8117d4b6ae29f737
This commit is contained in:
parent
41989b59cf
commit
57ee42601a
@ -5,8 +5,9 @@
|
||||
loop: '{{ base_packages }}'
|
||||
|
||||
- name: Include OS-specific variables
|
||||
include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
include_vars: "{{ lookup('first_found', file_list) }}"
|
||||
vars:
|
||||
file_list:
|
||||
- "{{ ansible_facts.distribution }}.{{ ansible_facts.architecture }}.yaml"
|
||||
- "{{ ansible_facts.distribution }}.yaml"
|
||||
- "{{ ansible_facts.os_family }}.yaml"
|
||||
@ -54,7 +55,6 @@
|
||||
|
||||
- name: Include OS-specific tasks
|
||||
include_tasks: "{{ lookup('first_found', file_list) }}"
|
||||
static: no
|
||||
vars:
|
||||
file_list:
|
||||
- "{{ ansible_facts.distribution }}.{{ ansible_facts.lsb.codename }}.{{ ansible_facts.architecture }}.yaml"
|
||||
|
@ -1,16 +1,17 @@
|
||||
- name: Include OS-specific variables
|
||||
include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
include_vars: "{{ lookup('first_found', file_list) }}"
|
||||
vars:
|
||||
file_list:
|
||||
- "{{ ansible_facts.distribution }}.{{ ansible_facts.architecture }}.yaml"
|
||||
- "{{ ansible_facts.distribution }}.yaml"
|
||||
- "{{ ansible_facts.os_family }}.yaml"
|
||||
- "default.yaml"
|
||||
|
||||
- name: Include OS-specific tasks
|
||||
include_tasks: "{{ item }}"
|
||||
static: no
|
||||
with_first_found:
|
||||
- files:
|
||||
include_tasks: "{{ lookup('first_found', params) }}"
|
||||
vars:
|
||||
params:
|
||||
files:
|
||||
- "{{ ansible_facts.distribution }}.{{ ansible_facts.lsb.codename }}.{{ ansible_facts.architecture }}.yaml"
|
||||
- "{{ ansible_facts.distribution }}.{{ ansible_facts.architecture }}.yaml"
|
||||
- "{{ ansible_facts.distribution }}.yaml"
|
||||
|
Loading…
Reference in New Issue
Block a user