Ansible 2.8.2 - yum list of local packages

I get a deprecation warning when running the below task when using yum module with local install. The variable “packages” comes from vars/centos_6.yml

**** This Works but provides deprecated warning ****

  • name: Include vars for host distribution
    include_vars: “{{ ansible_distribution|lower }}_{{ ansible_distribution_major_version }}.yml”

  • name: Install the package
    yum:
    name: “/var/tmp/{{item}}”
    state: present
    when: ansible_os_family == ‘RedHat’
    with_items:

  • “{{packages}}”

TASK [install : Install the package] *****************************************************************
[DEPRECATION WARNING]: Invoking “yum” only once while using a loop via squash_actions is deprecated. Instead of using a
loop to supply multiple items and specifying name: "/var/tmp/{{item}}", please use name: ['{{ packages }}'] 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.
changed: [servername.net] => (item=[u’/var/tmp/filename.el7.x86_64.rpm’])