Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add possibility to limit the list of examined network interfaces during fact gathering #17586

Closed
wants to merge 1 commit into from

Conversation

MerlinDMC
Copy link

We run Ansible against hosts that have more than 100 network interfaces configured. The setup task does take multiple minutes to complete which results in problems in our day to day operations.

We know exactly that we're only interested in a limited subset of interfaces facts so we need to limit the examined data.

This patch allows us to limit the fact gathering via a configuration entry like:

gather_network_interfaces = lo*,eth0,eth1

The overall gain here is the runtime for each setup task which drops from multiple minutes (2 - 10 minutes depending on the instance) to about 5 seconds.

This PR needs the additional change in ansible/ansible-modules-core#4865

- gather_network_interfaces allows us to limit the network facts
  gathering to a list of interfaces we're interested in.
@alikins
Copy link
Contributor

alikins commented Oct 4, 2016

Looking at this for 2.3.

Looking deeper at the network interface info collection code, I think there are some easy optimizations to be had there I'd like to address for 2.3, so that could help as well.

More generally, if the faces code were to try to attempt to detect the 'useful' network interfaces and potentially only collect those by default, is there any selection heuristic that would be useful?

@MerlinDMC
Copy link
Author

@alikins sorry it took a while until I could start answering.

About the selection heuristic: I think that is pretty impossible to predict since every operator can easily rename interfaces the name can't be used as the source of validity. In order to look deeper at the interface and do selections on other facts you already have to invest the time and gather all the information in order to select what to throw away - which also just feels wrong.

Imho the only viable option is to let the person running the tasks decide what is important for their actual situation.

In addition to that my code here also fetches the device for the default route and includes the interface that one is bound to so that (I hope) all the other standard module get enough information to operate without errors.

It might be useful to have include and exclude lists ... but I'm not sure if I would come into a situation where a include list with placeholders is not enough.

To give an overview of what our current situation looks like:
We have services deployed via a normal bridged network using docker on multiple host servers. Each of those servers will run > 100 of those and each container by default will generate a generic named interface attached to the bridge.

lo
eth0
docker0
vethc14cb32
veth76e6b45
...a lot more...
vethffacc63
vethf898333

And yes in this example it's obvious: remove all /^veth/ and the rest is pretty sensible.
But this naming will be different in future iterations of the platform so it will push us into the same issue again unless we can explicitly specify what at that point in time is important to gather.

@ansibot ansibot added affects_2.3 This issue/PR affects Ansible v2.3 c:module_utils/ needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Dec 13, 2016
@ansibot ansibot added needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html module_util and removed needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html labels Jan 2, 2017
@ansibot ansibot added module_util needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html labels Jan 5, 2017
@ansibot
Copy link
Contributor

ansibot commented Apr 11, 2017

@MerlinDMC Greetings! Thanks for taking the time to open this pullrequest. In order for the community to handle your pullrequest effectively, we need a bit more information.

Here are the items we could not find in your description:

  • issue type

Please set the description of this pullrequest with this template:
https://raw.githubusercontent.com/ansible/ansible/devel/.github/PULL_REQUEST_TEMPLATE.md

click here for bot help

@ansibot ansibot added needs_info This issue requires further information. Please answer any outstanding questions. needs_template This issue/PR has an incomplete description. Please fill in the proposed template correctly. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Apr 11, 2017
@ansibot ansibot added the support:core This issue/PR relates to code supported by the Ansible Engineering Team. label Jun 29, 2017
@ansibot ansibot added the new_contributor This PR is the first contribution by a new community member. label Oct 18, 2017
@ansibot ansibot removed the new_contributor This PR is the first contribution by a new community member. label Nov 3, 2017
@ansibot ansibot removed needs_info This issue requires further information. Please answer any outstanding questions. needs_template This issue/PR has an incomplete description. Please fill in the proposed template correctly. labels Nov 22, 2017
@ansibot ansibot added the new_contributor This PR is the first contribution by a new community member. label Jan 25, 2018
@ansibot ansibot added feature This issue/PR relates to a feature request. and removed feature_pull_request labels Mar 2, 2018
@ansibot ansibot added the support:community This issue/PR relates to code supported by the Ansible community. label Sep 18, 2018
@sivel
Copy link
Member

sivel commented Nov 16, 2018

Thank you very much for your submission. We have discussed this and decided against accepting this feature at this time.

Feel free to stop by the #ansible-devel channel, or during a core IRC meeting to discuss this issue and come the a consensus on an alternate approach.

If you have further questions please stop by IRC or the mailing list:

@sivel sivel closed this Nov 16, 2018
@MerlinDMC MerlinDMC deleted the gather_network_interfaces branch November 17, 2018 16:07
@ansible ansible locked and limited conversation to collaborators Jul 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.3 This issue/PR affects Ansible v2.3 c:constants c:module_utils/facts c:module_utils/ c:playbook/play feature This issue/PR relates to a feature request. module_util needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. new_contributor This PR is the first contribution by a new community member. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants