Why notify tasks aren't getting executed in ansible?
<p>The problem I am facing is quite common, but the other solutions didn't work for me. As the question suggests, when I run my playbook, only the first notify handler gets executed. i.e. only firewalld is restarted, but updated bash profile isn't sourced. </p>

<p>Some people suggested notify chaining, but I wouldn't like to merge two tasks with completely different objectives. For example, one task could be adding ports to firewalld and then restarting it; another could be update my bash profile to display date with <code>history</code> command output.</p>

<p>N.B. the above snippet isn't my full .yml, only a part of it, so this may or may not work. But, the original file does work. </p>

<pre><code>---
  tasks  
   - name: add port-80 to firewalld
     firewalld: zone=drop port=80/tcp permanent=true state=enabled

   - name: add port-443 to firewalld
     firewalld: zone=drop port=443/tcp permanent=true state=enabled

   - shell: firewall-cmd --reload
     notify:
      - Restart firewalld

   - name: Enabling time display in history
     blockinfile:
     dest: ~/.bash_profile
     block: |
         export HISTTIMEFORMAT="%d/%m/%y %T "
     notify:
      - Source the updated Bash profile


  handlers:
   - name: Restart firewalld
     service: name=firewalld state=restarted

   - name: Source the updated Bash profile
     shell: source ~/.bash_profile

...
</code></pre>