How to ger rid of "[WARNING]: Consider using dnf module rather than running dnf"?

2

1

Some of my ansible playbooks start with installation of python2-dnf package that is required for dnf ansible module to run.

tasks:
- name: Install required dnf python binding
  shell: dnf install -y python2-dnf
  changed_when: False

Direct call of dnf in shell module results in following warning

[WARNING]: Consider using dnf module rather than running dnf

How such warning can be avoided or what is the suggested way to make sure that package python2-dnf is installed and thus module dnf can be used?

czerny

Posted 2016-10-17T15:56:34.253

Reputation: 352

Answers

2

Shell warnings can be silenced by adding a warn=no to your shell command string like this:

tasks: - name: Install required dnf python binding shell: dnf install -y python2-dnf warn=no changed_when: False

Zlemini

Posted 2016-10-17T15:56:34.253

Reputation: 291