<p>The indentation is wrong. Correct syntax is</p>
<pre class="lang-yaml prettyprint-override"><code>     - name: install packages
       yum:
         name: httpd
         state: latest
       notify: restart package
</code></pre>
<p>The error says it:</p>
<pre><code>&quot;Unsupported parameters for (ansible.legacy.dnf) module: notify.
</code></pre>
<p><em>notify</em> is not a parameter of the module <a href="https://docs.ansible.com/ansible/latest/collections/ansible/builtin/dnf_module.html#ansible-builtin-dnf-module-manages-packages-with-the-dnf-package-manager" rel="nofollow noreferrer"><em>dnf</em></a> or <a href="https://docs.ansible.com/ansible/latest/collections/ansible/builtin/yum_module.html#ansible-builtin-yum-module-manages-packages-with-the-yum-package-manager" rel="nofollow noreferrer"><em>yum</em></a>. It is a <a href="https://docs.ansible.com/ansible/latest/reference_appendices/playbooks_keywords.html" rel="nofollow noreferrer"><em>playbook keyword</em></a> that can be applied to a block or a task. In the above case, it must be indented as a task keyword. See <a href="https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_handlers.html#notifying-handlers" rel="nofollow noreferrer">Notifying handlers</a>.</p>

CC BY-SA 4.0
2023-01-02T12:53:24.527Z
2023-01-02T13:01:16.960Z
2023-01-02T13:01:16.960Z
Vladimir Botka
<p>I'm trying to run a ansible task but I keep getting an error.</p>
<p>This is the play I want to run:</p>
<pre class="lang-yaml prettyprint-override"><code>- name: use of handlers
  hosts: all
  tasks:
    - name: install packages
      yum:
        name: httpd
        state: latest
        notify: restart package
  handlers:
    - name: restart package
      service:
        name: httpd
        state: restarted
</code></pre>
<p>But this is the error that ansible gives me:</p>
<blockquote>
<p>fatal: [serverb.local]: FAILED! =&gt; {&quot;changed&quot;: false, &quot;msg&quot;: &quot;Unsupported parameters for (ansible.legacy.dnf) module: notify. Supported parameters include: allowerasing, allow_downgrade, name (pkg), enablerepo, disable_excludes, conf_file, list, disable_plugin, installroot, enable_plugin, disable_gpg_check, download_dir, update_cache (expire-cache), releasever, state, nobest, bugfix, install_weak_deps, update_only, autoremove, exclude, download_only, cacheonly, security, lock_timeout, skip_broken, disablerepo, validate_certs, install_repoquery.&quot;}</p>
</blockquote>

<ansible><linux>
Ansible Unsupported Parameters for using handler
Sandy
# Ansible Unsupported Parameters for using handler

(Asked by: username_0 on 2023-01-02)

I'm trying to run a ansible task but I keep getting an error.
This is the play I want to run:
- name: use of handlers
  hosts: all
  tasks:
    - name: install packages
      yum:
        name: httpd
        state: latest
        notify: restart package
  handlers:
    - name: restart package
      service:
        name: httpd
        state: restarted

But this is the error that ansible gives me:

fatal: [serverb.local]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (ansible.legacy.dnf) module: notify. Supported parameters include: allowerasing, allow_downgrade, name (pkg), enablerepo, disable_excludes, conf_file, list, disable_plugin, installroot, enable_plugin, disable_gpg_check, download_dir, update_cache (expire-cache), releasever, state, nobest, bugfix, install_weak_deps, update_only, autoremove, exclude, download_only, cacheonly, security, lock_timeout, skip_broken, disablerepo, validate_certs, install_repoquery."}

**Tags:** ansible, linux


---

## 1 answers

### Answer by username_1 on 2023-01-02. Score: 3

The indentation is wrong. Correct syntax is
     - name: install packages
       yum:
         name: httpd
         state: latest
       notify: restart package

The error says it:
"Unsupported parameters for (ansible.legacy.dnf) module: notify.

notify is not a parameter of the module dnf or yum. It is a playbook keyword that can be applied to a block or a task. In the above case, it must be indented as a task keyword. See Notifying handlers.


---

