Sure, but then you need to install also python environment for Ansible,on a machine where only Apache or nginx are needed
Python is extremely easy to setup on Windows though.
Time have changed a lot though as you can now run complex bash scripts on the Windows Subsystem for Linux (published by Microsoft).
Windows Subsystem for Linux https://docs.microsoft.com/en-us/windows/wsl/about
Print Screens and Doc of running as Bash Script on Windows: https://fastsitephp.com/en/documents/file-encryption-windows
If python happens to disappear from all linux distros ansible can still work with the raw module.
In any case, the bash script posted is based on apt install so it's not going to work on much less amount of distros rather than if it was just an ansible role.