Решается путем вызова обеих задач в обработчиках с использованием listen.
---
- hosts: labservers
become: yes
tasks:
- name: restart httpd
service:
name: httpd
state: restarted
notify:
- cmds
handlers:
- name: change file details
replace:
path: /etc/httpd/conf/magic
regexp: '100 notes ashes'
replace: '100 akash'
register: httpd_data
listen: "cmds"
- name: debug details
debug:
msg:"{{ httpd_data }}"
listen: "cmds"