4

When installing packages through the Ansible's dnf module. How do I pass options like --nobest to dnf? Is there alternative to using raw shell commands.

Philippe
  • 1,715
  • 4
  • 25
  • 49

2 Answers2

0

I had similar problem (but i'm using yum package manager) and figured a work around here

The issue is that docker-ce has not been packaged for CentOS 8 yet.

An ugly workaround is to install containerd.io manually beforehand:

pre_tasks:
  - yum:
     name: https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm

So, try to set full package url as package name and it should definitely work.

Bharathvaj Ganesan
  • 3,054
  • 1
  • 18
  • 32
0

nobest can be passed as a parameter while using the DNF module in the playbook

You can refer here dnf_module for other options/parameters that can be passed to the dnf ansible module

For example :

- name: Install the latest version of Apache from the testing repo
  dnf:
    name: httpd
    enablerepo: testing
    state: present

- name: Install the latest version of Apache
  dnf:
    name: httpd
    state: present
    nobest: false
  • that works only if you are not on Redhat / Cent OS / Oracle Linux,they do not have the nobest option https://docs.ansible.com/ansible/2.9/modules/dnf_module.html – JustAnotherProgrammer May 12 '22 at 20:44