From 42df3a21425d4e696fa8a3065aebea654d0e5e3a Mon Sep 17 00:00:00 2001 From: Andrew Bonney Date: Fri, 15 Nov 2024 10:26:38 +0000 Subject: [PATCH] Ensure that first/last host detection is deterministic With ansible-core 2.16 a breaking changes landed [1] to some filters making their result returned in arbitrary order. With that, we were relying on them to always return exactly same ordered lists. With that we need to ensure that we still have determenistic behaviour where this is important. [1] https://github.com/ansible/ansible/issues/82554 Change-Id: I9ca1c66f88e9beea0e2c5add30a356fb717cfcfa --- vars/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vars/main.yml b/vars/main.yml index 8687cbd6..30d2556e 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -15,10 +15,10 @@ _rabbitmq_is_first_play_host: >- {{ - (inventory_hostname == (groups[rabbitmq_host_group] | intersect(ansible_play_hosts)) | first) | bool + (inventory_hostname == (groups[rabbitmq_host_group] | select('in', ansible_play_hosts)) | first) | bool }} _rabbitmq_is_last_play_host: >- {{ - (inventory_hostname == (groups[rabbitmq_host_group] | intersect(ansible_play_hosts)) | last) | bool + (inventory_hostname == (groups[rabbitmq_host_group] | select('in', ansible_play_hosts)) | last) | bool }}