From c3c1a12c31e6dbbf320963bc13b1f14ce353815d Mon Sep 17 00:00:00 2001 From: Georgina Shippey Date: Wed, 13 Nov 2019 12:00:08 +0000 Subject: [PATCH] Check conditional length before evaluation Ceilometer sometimes may not be used. On a run through of Stein to Train upgrade there is an error: 'Error while evaluating conditional ... list object has no element 0' This patch ensures that the ansible group has members before trying to reference the first group member. Change-Id: I4ffba430d174a32e586fefd8ee636b6b8405486e --- tasks/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/tasks/main.yml b/tasks/main.yml index c02b1776..4871d5e5 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -98,6 +98,7 @@ password: "{{ ceilometer_service_password }}" role: "{{ ceilometer_role_name }}" when: + - (groups[(ceilometer_services['ceilometer-agent-notification']['group'] | intersect(group_names))[0]] | intersect(ansible_play_hosts))[0] | length > 0 - inventory_hostname == (groups[(ceilometer_services['ceilometer-agent-notification']['group'] | intersect(group_names))[0]] | intersect(ansible_play_hosts))[0] tags: - ceilometer-config