--check (dry run) fires notify handlers

20 views
Skip to first unread message

ja.garcia...@gmail.com

unread,
Jul 7, 2016, 1:08:11 PM7/7/16
to Ansible Project
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.
Reply all
Reply to author
Forward
0 new messages