From f55d35ffb47cd8dbab1f015aa879ae9eea1e9d6a Mon Sep 17 00:00:00 2001 From: Aaron Guise Date: Sun, 13 Mar 2022 21:53:44 +1300 Subject: [PATCH] Use first found - Skipping if file not found --- tasks/main.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tasks/main.yml b/tasks/main.yml index ed12d9c..db13e1e 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,2 +1,8 @@ --- -- include: "{{ ansible_os_family }}.yml" \ No newline at end of file +- name: Include tasks only if one of the files exist, otherwise skip the task + include_tasks: + file: "{{ item }}" + with_first_found: + files: + - "{{ ansible_os_family }}.yml" + skip: True