convert centos dnf command into ansible

There's nothing built in to Ansible to manage Copr repos, so running the command is fine, but you should make it idempotent by not running it if the repo is already installed.

For example:

- name: Install copr repo konimex/neofetch
  command:
    cmd: dnf -y copr enable konimex/neofetch
    creates: /etc/yum.repos.d/_copr:copr.fedorainfracloud.org:konimex:neofetch.repo
  when: ansible_pkg_mgr == "dnf"

Thus when the repo file is already present, the command will not run again, and the task will return ok instead of changed.

(You also should use command instead of shell whenever possible.)