refactor: Use custom loop_var in with_first_found invocations

Otherwise "item" will already be bound when it's used somewhere in the included tasks
This commit is contained in:
Jannik Beyerstedt 2026-03-20 12:12:13 +01:00
parent 758bbf33f9
commit 085a446b05
6 changed files with 18 additions and 6 deletions

View file

@ -16,12 +16,14 @@
- name: VSCode - Install and configure VS Code
tags: vscode
ansible.builtin.include_tasks:
file: "{{ item }}"
file: "{{ with_first_found_item }}"
apply:
tags: vscode
with_first_found:
- "devel-{{ ansible_facts['distribution'] }}.yml"
- "devel-{{ (override_os_family is defined) | ternary(override_os_family, ansible_facts['os_family']) }}.yml"
loop_control:
loop_var: with_first_found_item
# Install Visual Studio Code and Set Basic Configuration
- name: VSCode - Basics