From 5147f4029bcca97dd66ac33a342138906662a89a Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Wed, 1 Nov 2017 01:25:46 +0200 Subject: [PATCH] roles/common: Use static imports for tasks Something seems to have happened as of Ansible 2.4.0.0 where this no longer works. I suspect it is related to the major changes to static and dynamic imports that landed around this same time. In practice this achieves the same function, but without the "magic" ability to use one task for different operating systems. --- roles/common/tasks/main.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index 9722793..692234b 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -10,11 +10,23 @@ tags: ntp - name: Install common packages - include_tasks: packages_{{ ansible_distribution }}.yml + import_tasks: packages_Debian.yml + when: ansible_distribution == 'Debian' + tags: packages + +- name: Install common packages + import_tasks: packages_Ubuntu.yml + when: ansible_distribution == 'Ubuntu' tags: packages - name: Configure firewall - include_tasks: firewall_{{ ansible_distribution }}.yml + import_tasks: firewall_Debian.yml + when: ansible_distribution == 'Debian' + tags: firewall + +- name: Configure firewall + import_tasks: firewall_Ubuntu.yml + when: ansible_distribution == 'Ubuntu' tags: firewall - name: Configure secure shell daemon