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.
This commit is contained in:
Alan Orth 2018-03-18 22:29:52 +02:00
parent 7fc13d6331
commit 9f3ab01d48

View File

@ -3,12 +3,12 @@
# can capitalize on that and use the same tasks. # can capitalize on that and use the same tasks.
- name: Configure php-fpm on Ubuntu 16.04 and Debian 9 - 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', '==')) 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 tags: php-fpm
- name: Configure php-fpm on Ubuntu 18.04 - 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', '==') when: ansible_distribution == 'Ubuntu' and ansible_distribution_version | version_compare('18.04', '==')
tags: php-fpm tags: php-fpm