On Mon, 21 Jun 2021 21:57:03 -0700 (PDT)
Stefan Engel <bkken...@gmail.com> wrote:

> I'm getting the following error:
> *ERROR! 'notify' is not a valid attribute for a Block*
> 
> In the Ansible doc, I couldnt find a clear statement that notify isnt 
> supported within a Block. 

See "Playbook Keywords". In 2.9, only task can notify a handler
https://docs.ansible.com/ansible/2.9/reference_appendices/playbooks_keywords.html

"latest" shows both task and block can notify a handler
https://docs.ansible.com/ansible/latest/reference_appendices/playbooks_keywords.html

Works for me in 2.10

- hosts: localhost
  tasks:
    - block:
        - command: 'true'
          changed_when: true
      notify: test
  handlers:
    - name: test
      debug:
        msg: Handler test running.

gives

ok: [localhost] => 
  msg: Handler test running.

-- 
Vladimir Botka

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20210622080947.13a26814%40gmail.com.

Attachment: pgpIyooSNwZEA.pgp
Description: OpenPGP digital signature

Reply via email to