Ansible’s yum_versionlock module has been available in Ansible for several years. Since my initial release this module has also been tweaked and forked as dnf_versionlock. However, there has been a new feature request for supporting specific package versions to pin and lock. Starting with community general version 7.2, yum_versionlock is also able to handle specific versions instead of just plain package names.
Links:
feature(yum_versionlock): Add support to pin specific package versions #6861