What is the ansible equivalent command below? I have searched and cant seem to find a way to do it in ansible except by using the shell module. Which might work, but not the best option.
"dnf -y copr enable konimex/neofetch"
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.
- 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
Thus when the repo file is already present, the command will not run again, and the task will return
ok instead of
(You also should use
command instead of
shell whenever possible.)
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.