---
- name: restart ceilometer services
  service: name={{ item.name }} state=restarted must_exist=false
  when: restart|default('True')
  with_items:
    - "{{ ceilometer.services.ceilometer_api }}"
    - "{{ ceilometer.services.ceilometer_collector }}"
    - "{{ ceilometer.services.ceilometer_notification }}"
    - "{{ ceilometer.services.ceilometer_polling }}"

- name: restart ceilometer data services
  service: name={{ item.name }} state=restarted must_exist=false
  when: restart|default('True')
  with_items:
    - "{{ ceilometer.services.ceilometer_polling }}"
    - "{{ ceilometer.services.ceilometer_polling_compute }}"

---
- name: restart ceilometer services
  service: name={{ item.name }} state=restarted must_exist=false
  when: restart|default('True')
  failed_when: false
  with_items:
    - "{{ ceilometer.services.ceilometer_api }}"
    - "{{ ceilometer.services.ceilometer_collector }}"
    - "{{ ceilometer.services.ceilometer_notification }}"
    - "{{ ceilometer.services.ceilometer_polling }}"

- name: restart ceilometer data services
  service: name={{ item.name }} state=restarted must_exist=false
  when: restart|default('True')
  failed_when: false
  with_items:
    - "{{ ceilometer.services.ceilometer_polling }}"
    - "{{ ceilometer.services.ceilometer_polling_compute }}"

Add failed_when for restarting ceilometer services
Add failed_when for restarting ceilometer services

Restarting the ceilometer services on the compute node fails
because some of the services are not present. This ignores that.
