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
srvis not formatted with correct ansible yaml. You need to indicate each with a-. Second, the tasks are calling "{{ srv }}" as if it was a single value, but it contains a list of values and it can't handle that. The way you iterate over a list contained in a variable is withloop: