In CentOS 7, Ansible has the yum-repository module that can be used for adding repositories.
In CentOS 8 there exists the dnf module for package management, but there doesn't seem to be a dnf-repository module to add repositories.
How do you achieve this on CentOS 8 with Ansible?
As you found out, there is not (yet ?...) a
module. Meanwhile, from the Fedora system administration guide - Managing dnf repositoriesdnf_repositorySince the
yum_repositoriesmodule manages files in/etc/yum.repos.d/by default, it should work out of the box.An other track to follow eventually, as stated in the
yum_repositorymodule documentation is to use theini_filemodule directly to create or modify your repository definition.