From 9f3ab01d487d10cef50733337ff9d35bf2a1a351 Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Sun, 18 Mar 2018 22:29:52 +0200 Subject: [PATCH] roles/php-fpm: Use include instead of import for tasks These tasks are conditional and mutually exclusive due to the "when" clause. Using import_tasks means that these are imported before the playbook execution and then skipped during evaluation of the test. It makes sense in this case to use include_tasks so that the tasks are only imported during playbook execution if the condition is met. --- roles/php-fpm/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/php-fpm/tasks/main.yml b/roles/php-fpm/tasks/main.yml index f6010af..c5753f0 100644 --- a/roles/php-fpm/tasks/main.yml +++ b/roles/php-fpm/tasks/main.yml @@ -3,12 +3,12 @@ # can capitalize on that and use the same tasks. - name: Configure php-fpm on Ubuntu 16.04 and Debian 9 - import_tasks: Ubuntu.yml + include_tasks: Ubuntu.yml when: (ansible_distribution == 'Ubuntu' and ansible_distribution_version is version_compare('16.04', '==')) or (ansible_distribution == 'Debian' and ansible_distribution_major_version is version_compare('9', '==')) tags: php-fpm - name: Configure php-fpm on Ubuntu 18.04 - import_tasks: Ubuntu_18.04.yml + include_tasks: Ubuntu_18.04.yml when: ansible_distribution == 'Ubuntu' and ansible_distribution_version | version_compare('18.04', '==') tags: php-fpm