Answers: <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>
  
Answers: CC BY-SA 4.0
Answers: 2023-01-02T12:53:24.527Z
Answers: 2023-01-02T13:01:16.960Z
Answers: 2023-01-02T13:01:16.960Z
Answers: Vladimir Botka
Body: <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>
  
Tags: <ansible><linux>
Title: Ansible Unsupported Parameters for using handler
UserDisplayName: Sandy
ThreadText: # 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:
  
  ```yaml
  - 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
  
  ```yaml
       - 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*](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/dnf_module.html#ansible-builtin-dnf-module-manages-packages-with-the-dnf-package-manager) or [*yum*](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/yum_module.html#ansible-builtin-yum-module-manages-packages-with-the-yum-package-manager). It is a [*playbook keyword*](https://docs.ansible.com/ansible/latest/reference_appendices/playbooks_keywords.html) 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](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_handlers.html#notifying-handlers).
  
  
  ---
  
  