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
This commit is contained in:
Andrew Bonney
2024-11-15 10:26:38 +00:00
parent 461ccfa46c
commit 42df3a2142

View File

@@ -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
}}