ubuntu – “msg”: “Unsupported parameters for (dnf) module: update_cache

I’m trying to update CentOS 7 through Ubuntu 18 and the update_cache can’t be read by the dnf, I have installed and updated dnf in CentOS, there is no solution to my question from the internet.

my Code is:

 - name: update repository index for CentOS
    dnf:
      update_cache: yes
    when: ansible_distribution == "CentOS"

  - name: install apache and php packages for CentOS
    dnf:
      name:
        - httpd
        - php
      state: latest
    when: ansible_distribution == "CentOS"

The error says: FAILED! => {“changed”: false, “msg”: “Unsupported parameters for (dnf) module: update_cache Supported parameters include: autoremove, conf_file, disable_gpg_check, disablerepo, enablerepo, installroot, list, name, state”}

Please help me fix this problem

Read more here: Source link