# Performance issue when loading all host group vars before starting playbook

**URL:** <https://forum.ansible.com/t/performance-issue-when-loading-all-host-group-vars-before-starting-playbook/23120>\
**Category:** Ansible Project\
**Created:** [November 28, 2016, 2:50pm UTC](https://forum.ansible.com/t/performance-issue-when-loading-all-host-group-vars-before-starting-playbook/23120 "2016-11-28T14:50:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Wadleigh](https://avatars.discourse-cdn.com/v4/letter/j/90ced4/32.png) [@John\_Wadleigh](https://forum.ansible.com/u/John_Wadleigh)\
**Post date:** [November 28, 2016, 2:50pm UTC](https://forum.ansible.com/t/performance-issue-when-loading-all-host-group-vars-before-starting-playbook/23120/1 "2016-11-28T14:50:48Z")

</div>

Hi everyone,

We have a large ‘hosts’ file with many different host groups defined.  
When running ansible-playbook command with ‘-i’ pointing to our hosts file, Ansible will then call our custom code in the VarsModule class of our vars plugin. Ansible calls the get\_group\_vars() function for each host group in the hosts file. As our hosts file contains a lot of host groups, this increases the time to load all of the vars from all of the host groups.  
I tried to limit the host group by using the “–limit” parameter but this still results in Ansible triggering for all host groups.  
Basically this results in about 7 seconds delay before Ansible starts the playbook. This can be costly since we run a lot of playbooks during our deployments.

Is there a better way to do this?

Thanks
