---
- name: Install packages thru loop
  hosts: localhost
  vars:
   packages: [ftp,telnet,htop)  

  tasks:
- name: Install packages
  yum
    name: ‘{{packages}}’
    state: present
