Block of include_tasks with handler/notify

Hi,

Im trying to achieve the following:

  • creating a block with multiple include tasks
  • If any of the tasks change, write the config and sync to HA device (F5)

tasks:

  • name: F5 Vanity VIP update in all DC’s
    block:
  • name: Update SSL profile
    include_tasks: tasks/vanity/f5_ssl_profile_update.yml
  • name: Update irule
    include_tasks: tasks/vanity/f5_irule_update.yml
    notify:
  • Save sys config
  • Sync configuration from device to group
    handlers:
  • name: Save sys config
  • name: Sync configuration from device to group

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.

Appreciate your feedback.

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.

/scratch/ansible-release-notes/CHANGELOG-v2.11.rst:- notify keyword
is not ignored anymore on import_tasks, also able to apply to blocks
now.

Thanks Vladimir! I’ll upgrade to 2.11.x core and give it another try