How to Handle Diverse System Architectures and Operating System Components

Hello all, :waving_hand:

the last few days I have been working with a heterogeneous system landscape that are to be processed with Ansible. The challenge is, on the one hand, to use an architecture-dependent software component and, on the other hand, to create an Ansible module that can be used with different Python versions.The diversity of different systems in enterprise environments is probably nothing unusual, I assume. Are there any best practices or experiences for such requirements?

An example: Python code is used in development that is only available from version 3.10 onwards. This only becomes apparent in the test environment. And a Python package is used that has a dependency on the architecture. This also only becomes apparent in the test environment. The diversity in production is not known. The question is how can I handle with this best?

Thanks for tips and hints.
Best regards
Stefan