Artificial intelligent assistant

Passing looped variable to ansible role Is there a way to pass a list of values to /vars/main.yml file to subsequently pass those variables to the tasks for processing. The intention here is to running the task once rather than N times. My current `/vars/main.yml` --- srv: httpd nginx parses as `TASK [app : Install the httpd nginx server package] ************` which is not liked by yum module. --- - name: Install the {{ srv }} server package yum: name: "{{ srv }}" state: present - name: Check for the installed package yum: list: "{{ srv }}" register: yumout - debug: var: yumout

The playbook might look this way. I have not tested the code, it's just off the cuff...


---
- hosts: all
tasks:
- name: Install the {{ srv }} server package
yum:
name: "{{ item }}"
state: present
loop: "{{ srv }"
- name: Check for the installed package
yum:
list: "{{ srv }}"
loop: "{{ srv }"
register: yumout
- debug:
msg: yumout

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy a3fd4e0e608b4267063e467348665fe2