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: I4d714e252022b1ebd502634d7ea6a77ca0bfe6c7
This commit is contained in:
Dmitriy Rabotyagov 2024-07-22 16:16:31 +02:00
parent a5b5c2d870
commit 76cd5e0730

View File

@ -16,12 +16,12 @@
_placement_is_first_play_host: >-
{{
(placement_services['placement-api']['group'] in group_names and inventory_hostname == (
groups[placement_services['placement-api']['group']] | intersect(ansible_play_hosts)) | first) | bool
groups[placement_services['placement-api']['group']] | select('in', ansible_play_hosts)) | first) | bool
}}
_placement_is_last_play_host: >-
{{
(placement_services['placement-api']['group'] in group_names and inventory_hostname == (
groups[placement_services['placement-api']['group']] | intersect(ansible_play_hosts)) | last) | bool
groups[placement_services['placement-api']['group']] | select('in', ansible_play_hosts)) | last) | bool
}}