From 860b70aa87e8b7ed37d78169a31d2142480092e6 Mon Sep 17 00:00:00 2001 From: Scott Wallace Date: Sun, 20 Jan 2019 18:16:21 +0000 Subject: [PATCH] Dynamically work out which OS tasks to call --- .ansible/roles/desktop/tasks/main.yaml | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/.ansible/roles/desktop/tasks/main.yaml b/.ansible/roles/desktop/tasks/main.yaml index 20f1ec0..66902da 100644 --- a/.ansible/roles/desktop/tasks/main.yaml +++ b/.ansible/roles/desktop/tasks/main.yaml @@ -1,15 +1,8 @@ -- name: Linux desktop tasks - block: - - import_tasks: linux/software.yaml - - import_tasks: linux/config.yaml - when: ansible_system == 'Linux' - -- name: OS X desktop tasks - block: - - import_tasks: darwin/homebrew.yaml - - import_tasks: darwin/mas.yaml - - import_tasks: darwin/prefs.yaml - when: ansible_system == 'Darwin' +- name: Desktop tasks + include_tasks: "{{ loop_task }}" + loop: "{{ query('fileglob', \"{{ ansible_system|lower }}/*\") }}" + loop_control: + loop_var: loop_task - name: Common desktop tasks import_tasks: firefox.yaml