From fc4cf5e2afc07b32808f37de4b07572be47b27d5 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Mon, 16 Sep 2019 13:57:44 +0200 Subject: [PATCH] refactor task includes --- tasks/debian.yml | 2 +- tasks/main.yml | 14 +++++++++----- tasks/redhat.yml | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/tasks/debian.yml b/tasks/debian.yml index 1443466..1f9fe50 100644 --- a/tasks/debian.yml +++ b/tasks/debian.yml @@ -1,5 +1,5 @@ --- -- name: Upgrade packages (debian) +- name: Upgrade packages apt: update_cache: yes upgrade: dist diff --git a/tasks/main.yml b/tasks/main.yml index 6fbfba4..dfb2adb 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,6 +1,10 @@ --- -- include_tasks: redhat.yml - when: "'redhat' in group_names or 'redhat_arm' in group_names" - -- include_tasks: debian.yml - when: "'debian' in group_names or 'debian_pve' in group_names or 'debian_ucs' in group_names" +- include_tasks: "{{ lookup('first_found', params) }}" + vars: + params: + files: + - "{{ ansible_lsb.id | default('') | lower }}.yml" + - "{{ ansible_os_family | lower }}.yml" + paths: + - "tasks" + errors: "ignore" diff --git a/tasks/redhat.yml b/tasks/redhat.yml index 8ad2b77..ff67186 100644 --- a/tasks/redhat.yml +++ b/tasks/redhat.yml @@ -1,5 +1,5 @@ --- -- name: Upgrade packages (rhel) +- name: Upgrade packages yum: name: "*" state: latest