Ansible Playbook iterating through different variable files

Hi All,

I am developing a playbook with a health check functionality of an large environment in which there are multiple Applications and Webservers which are Interconnected with each other.
Each application has already prepared variable file with the all needed information for it. Some of the variables are arrays.

Important thing: the variable names within each of the variable files are identical.

I am pasting the content of two variable files:

##File: pil-az1.yml
##Content:

`
target_hosts:

  • server001
  • server002
    target_service: jboss7D
    target_ws_service: httpd
    target_user: user-as
    target_checks:
  • /scripts/checks/health_pil.sh
  • /scripts/checks/health_pil2.sh
    feeding_servers:
  • serverw001
  • serverw002
    feeding_users:
  • user-au
    feeding_path: http/chroot/htdocs/mode
    feeding_file: status.html
    app_dir: jboss
    Applications: authentication
    Instance: pilot
    `

##File: pil-of.yml
##Content:

You would need to include_vars on one file, do some task(s), and then include the next var and do some task(s) and so on.

With include_tasks you can loop over a yaml file with one or more tasks in it.

The variable files you can add in a variable that you use in the loop, if you need get the variable dynamicly use the find module.