--check (dry run) fires notify handlers

Hi,

I am runnig a playbook in check mode (–check --diff) to verify which changes are going to be applied in a service config file.
The problem is that the dry run thinks the change is applied and fires the notify handler, restarting the service with no change applied

On a production enviroment that can be catastrofical

¿ is there any way to avoid the handler on dry run mode ?

Example code:

task/main.yml

  • name: configure elasticsearch
    template: src={{ item[1:] }}.j2 dest={{ item }}
    owner=root group=root mode=0644
    with_items:
  • ‘/etc/default/elasticsearch’
  • ‘{{ elasticsearch_path_conf }}/elasticsearch.yml’
  • ‘{{ elasticsearch_path_conf }}/logging.yml’
    notify:
  • restart elasticsearch
    tags:
  • configure

handlers/main.yml

  • name: restart elasticsearch
    service: >
    name=elasticsearch
    state=restarted
    enabled=yes

Thanks in advance.