Fix apt module loop to avoid deprecation notices

[DEPRECATION WARNING]: Invoking "apt" only once while using a loop via
squash_actions is deprecated. Instead of using a loop to supply multiple items
and specifying `name: "{{ item }}"`, please use `name: ['php5.6-common',
'php7.0-common', 'php7.1-common', 'php7.2-common', 'php7.3-common']` and remove
the loop. This feature will be removed in version 2.11. Deprecation warnings
can be disabled by setting deprecation_warnings=False in ansible.cfg.
This commit is contained in:
m.moraes 2019-04-09 03:14:58 +00:00
parent bf000f5535
commit 042b9f01c8
2 changed files with 10 additions and 8 deletions

View File

@ -46,14 +46,9 @@
# PHP package purges.
- name: Purge PHP version packages.
apt:
name: "{{ item }}"
name: "{{ __php_versions_debian |
reject('search', 'php' ~ php_version) |
list }}"
state: absent
purge: true
force: true
with_items:
- php5.6-common
- php7.0-common
- php7.1-common
- php7.2-common
- php7.3-common
when: "'php' + php_version not in item"

View File

@ -37,3 +37,10 @@ __php_packages:
- "php{{ php_version }}-sqlite3"
- "php{{ php_version }}-xml"
- "php{{ php_version }}-yaml"
__php_versions_debian:
- php5.6-common
- php7.0-common
- php7.1-common
- php7.2-common
- php7.3-common