1

I have a playbook that I run tags "configure" and new configuration gets copied and I see the changed status in the playbook logs but finally handlers are skipped so my new configuration is not loaded

playbook log

TASK [my-server : Validate and copy config] ********
changed: [server101] => (item=/home/myitem.conf)

RUNNING HANDLER [my-server : reload service] **************
skipping: [server101]

here is my task

main.yml

- include: configure.yml
  become: true
  tags:
    - configure

handler

- name: reload service
  become: true
  supervisorctl:
    name: xxxx
    state: restarted
  listen: "reload service"
  when: xxx == "true"

task in configure.yml:

- name: Validate and copy config
  copy:
    src: "{{ item }}"
    dest: "{{ config_dir }}"
    owner: root
    group: root
    mode: 0640
    validate: "/xxx/xxx/tool check %s"
  with_fileglob:
    - /tmp/configs/*.config
  notify:
    - reload service

where I'm doing wrong?

8
  • Is this a role file? Your handler should be in a handler file.
    – kenlukas
    Nov 25, 2019 at 19:05
  • @kenlukas updated the question
    – Jack
    Nov 26, 2019 at 11:28
  • Where is xxx being set? The only way I can recreate your results is when xxx != "true".
    – kenlukas
    Nov 26, 2019 at 13:30
  • xxx is in defaults set to true @kenlukas
    – Jack
    Nov 26, 2019 at 15:49
  • I'd try running it without the when: xxx == "true" and see what happens.
    – kenlukas
    Nov 26, 2019 at 16:01

1 Answer 1

0

I am assuming you obfuscated your task? There are no tags on that either? So that shouldn't be running. But lets assuming it is running, and you had just removed the tags as part of your obfuscation.

I would be tempted to either add the 'configure' tag to your handlers, or perhaps the 'always' tag.

1
  • okay I updated the question. have a look
    – Jack
    Nov 26, 2019 at 11:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .