title: Ansible Roles and handlers - Cannot get role handlers to work
body: <p>I need to set up Apache/mod_wsgi in Centos 6.5 so my main YAML file is as such:</p>
  
  <pre><code>---
  - hosts: dev
    tasks:
      - name: Updates yum installed packages
        yum: name=* state=latest
  
  
  - hosts: dev
    roles:
      - { role: apache }
  </code></pre>
  
  <p>This should update all yum-installed packages then execute the apache role.</p>
  
  <p>The apache role is configured to install Apache/mod_wsgi, set Apache to start at boot time and restart it. The following are the contents of <code>roles/apache/tasks/main.yml</code>:</p>
  
  <pre><code>---
  - name: Installs httpd and mod_wsgi
    yum: name={{ item }} state=latest
    with_items:
      - httpd
      - mod_wsgi
    notify:
      - enable httpd
      - restart httpd
  </code></pre>
  
  <p>And the handlers in <code>roles/apache/handlers/main.yml</code>:</p>
  
  <pre><code>---
  - name: enable httpd
    service: name=httpd enabled=yes
  
  - name: restart httpd
    service: name=httpd state=restarted
  </code></pre>
  
  <p>The handlers do not seem to run since the following output is given when I execute the playbook:</p>
  
  <pre><code>PLAY [dev] ******************************************************************** 
  
  GATHERING FACTS *************************************************************** 
  ok: [dev.example.com]
  
  TASK: [Updates yum installed packages] **************************************** 
  ok: [dev.example.com]
  
  PLAY [dev] ******************************************************************** 
  
  GATHERING FACTS *************************************************************** 
  ok: [dev.example.com]
  
  TASK: [apache | Installs httpd and mod_wsgi] ********************************** 
  ok: [dev.example.com] =&gt; (item=httpd,mod_wsgi)
  
  PLAY RECAP ******************************************************************** 
  dev.example.com            : ok=4    changed=0    unreachable=0    failed=0 
  </code></pre>
  
  <p>And when I <code>vagrant ssh</code> into the virtual machine, <code>sudo service httpd status</code> shows <code>httpd</code> is stopped and <code>sudo chkconfig --list</code> shows it has not been enabled to be started by <code>init</code>.</p>
  
  <p>I'm just starting out with Ansible, so is there something obvious I could be missing?</p>