single role across all hosts but with different vars based on group

Looking to speed up the runtime of our ansible playbook I’m looking to run a role called logstash-shipped across all hosts

  • hosts: all
    roles:

  • logstash-shipper

but load it with different vars depending on what group the host is in. Currently we have this split up into multiple tasks that run under each group but it would speed our build time significantly if we could run it only once.

example:

nginx group vars

log_files:

  • path: “/var/log/nginx/access.log”
    type: nginx-access
  • path: “/var/log/nginx/error.log”
    type: nginx-error

application group vars

log_files:

  • path: “/var/log/app/*_console.log”
    type: app-console
  • path: “/var/log/app/frontend_admin.log”
    type: app-json