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

feat: add specific code path for AWX #26

Merged
merged 2 commits into from
Mar 6, 2024
Merged

feat: add specific code path for AWX #26

merged 2 commits into from
Mar 6, 2024

Conversation

damcav35
Copy link
Contributor

@damcav35 damcav35 commented Mar 6, 2024

The ansible bastion wrapper default lookup to get bastion vars, is to run "ansible-inventory --list" A downside of this way of doing, is that the whole inventory is going to be evaluated, and if we are using some custom vars plugins, there are executed to. It can end up being very time consuming.

When using AWX, the whole inventory is available in the AWX Execution Environment as a file. So it is much easier and faster to get the host associated to the requested ip (the ip sent by Ansible to the ssh wrapper). Then, we can look for the bastion vars in the host vars, and if not found, execute "ansible-inventory --host" on the specific host, instead of the whole inventory.

The ansible bastion wrapper default lookup to get bastion vars, is to run "ansible-inventory --list"
A downside of this way of doing, is that the whole inventory is going to be evaluated, and if we are using some custom vars plugins, there are executed to.
It can end up being very time consuming.

When using AWX, the whole inventory is available in the AWX Execution Environment as a file.
So it is much easier and faster to get the host associated to the requested ip (the ip sent by Ansible to the ssh wrapper).
Then, we can look for the bastion vars in the host vars, and if not found, execute "ansible-inventory --host" on the specific host, instead of the whole inventory.
@speed47 speed47 merged commit 5c7c446 into ovh:main Mar 6, 2024
1 check passed
wilfriedroset pushed a commit that referenced this pull request Apr 26, 2024
* feat: add specific code path for AWX

The ansible bastion wrapper default lookup to get bastion vars, is to run "ansible-inventory --list"
A downside of this way of doing, is that the whole inventory is going to be evaluated, and if we are using some custom vars plugins, there are executed to.
It can end up being very time consuming.

When using AWX, the whole inventory is available in the AWX Execution Environment as a file.
So it is much easier and faster to get the host associated to the requested ip (the ip sent by Ansible to the ssh wrapper).
Then, we can look for the bastion vars in the host vars, and if not found, execute "ansible-inventory --host" on the specific host, instead of the whole inventory.

* remove isort, as it conflicts with black to maange import with style

---------

Co-authored-by: Damien Cavagnini <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants