Handlers called but not working

In the ansible output it says:

META: ran handlers

For this role handlers/main.yml is:

- name: restart_and_enable_httpd
  service:
    name:     httpd
    state:    restarted
    enabled:  true

This is Ansible 2.6 on RHEL 6. httpd is installed earlier in the process but at the end it is not running nor is it turned on per checkconfig. 

What am I missing, besides a brain, a clue, and a life?

Thanks!

Leam

In the ansible output it says:

  META: ran handlers

This indicates that it run all the handler that was notified so that mean not necessarily all the handlers.

For this role handlers/main.yml is:

- name: restart_and_enable_httpd
  service:
    name: httpd
    state: restarted
    enabled: true

This is Ansible 2.6 on RHEL 6. httpd is installed earlier in the process but at the end it is not running nor is it turned on per checkconfig.

Did you add a notify on this install task?

In the ansible output it says:

META: ran handlers

This indicates that it run all the handler that was notified so that mean not necessarily all the handlers.

Ah, good to know! There are 4 places where the handler is called, which was another question.

For this role handlers/main.yml is:

  • name: restart_and_enable_httpd
    service:
    name: httpd
    state: restarted
    enabled: true

This is Ansible 2.6 on RHEL 6. httpd is installed earlier in the process but at the end it is not running nor is it turned on per checkconfig.

Did you add a notify on this install task?

Yes, with the note that I actually fixed the handler names to match.

include has only ok and failed status and not changed.
It's the changed that trigger a notify, so you need to have the notify on the install task instead.

Kai, thanks! I made the restart a playbook of it’s own since everything else could be optioned out at some point in time.

Leam