Repository navigation
Install the elasticsearch library into its own venv on the Logstash host - #564
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
elasticsearch_roleandelasticsearch_userneed version 8 of theelasticsearchPython library on the host they run on. The elasticstack role installed it on every host, pip first and the distribution package if pip failed. A fresh host has no pip, so it got the distribution package, version 7 on Ubuntu 22.04 and EL 9, and creating the logstash writer role failed.The logstash role now installs the library where the two modules run, on the Logstash host, and only when
logstash_create_roleorlogstash_create_useris true. It goes into its own virtual environment,/opt/netways-elasticstack/venv, created with the Python that Ansible uses on that host, and the two tasks run with that interpreter. The system Python stays untouched. The distribution package is no option: of the current releases only Debian 13 ships 8.x, Ubuntu 22.04, Ubuntu 24.04 and EPEL 9 ship 7.x, and Ubuntu 26.04 ships 9.x, which does not work with Elasticsearch 8.Besides
python3-venvon Debian and Ubuntu the role installspython3-packaging. The pip module stops withoutpackagingorsetuptoolsin the system Python, and a fresh host has neither.The pip/package fallback is removed from the elasticstack role, and with it
elasticstack_manage_pipandelasticstack_force_pip. Setups that set them get no error, the values just have no effect anymore.python3-cryptographystays, the certificate checks need it on every host.The README listed the library under the control node and said that no version works with Elasticsearch 8 and 9. It now lists it under the target hosts, and version 8 works with both. The logstash README says that the Logstash host needs access to PyPI or to a pip mirror.
The full stack Molecule scenario removes pip, packaging and setuptools from its containers and checks that they are gone, so it runs like a fresh host. The images ship all three, which is why CI never saw the problem.
elasticsearch<9is dropped from requirements-test.txt, the modules run in the containers and not on the runner.Tested in containers with ansible-core 2.18 and 2.21 on Ubuntu 22.04, Debian 13 and Rocky 9: the first run creates the venv with elasticsearch 8.19.3, the second changes nothing, and
elasticsearch_roleloads the library from the venv.https://github.com/elastic/elasticsearch-py#compatibility
Closes #562