I'm having trouble getting a task within an ansible role to trigger handlers. Here are the files I'm using:
roles/services/tasks/postgresql.yml
shows
- name: install postgresql packages
apt: name={{ item }} state=present
sudo: yes
with_items:
- postgresql
- libpq-dev
- python-psycopg2
notify:
- set postgres password
- configure md5 security
- restart postgres server
roles/services/handlers/main.yml
shows
- name: set postgres password
sudo: yes
sudo_user: postgres
postgresql_user: name=postgres password=newpass
- name: configure md5 security
sudo: yes
copy: src=pg_hba.conf dest=/etc/postgresql/9.3/main/pg_hba.conf group=postgres owner=postgres backup=yes
- name: restart postgres server
sudo: yes
service: name=postgresql enabled=yes state=restarted
When I run the playbook, the task succeeds and acknowledges that it changed state, but it does not trigger the handlers. This is the last task in that role, and when it's done, ansible moves on to the first task in the next role in my playbook:
TASK: [services | install postgresql packages] ********************************
changed: [IP.REMOVED.##] => (item=postgresql,libpq-dev,python-psycopg2)
TASK: [passenger | install passenger gem] *************************************
I've tried changing the indentation in various ways, without success. I hope someone with fresh eyes will see what I'm missing.