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:
parent
758bbf33f9
commit
085a446b05
6 changed files with 18 additions and 6 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
# Common/Essentials: Essential Utilities (git, curl; vim, tmux, zsh, pip)
|
||||
|
||||
- name: Essentials - Install essential utilities
|
||||
ansible.builtin.include_tasks: "{{ item }}"
|
||||
ansible.builtin.include_tasks: "{{ with_first_found_item }}"
|
||||
with_first_found:
|
||||
- "essentials-{{ ansible_facts['distribution'] }}.yml"
|
||||
- "essentials-{{ (override_os_family is defined) | ternary(override_os_family, ansible_facts['os_family']) }}.yml"
|
||||
loop_control:
|
||||
loop_var: with_first_found_item
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
# Common/Tools: Additional Tools (depending on OS) (rsync; dnsutils, htop, unzip)
|
||||
|
||||
- name: Tools - Install basic utilities
|
||||
ansible.builtin.include_tasks: "{{ item }}"
|
||||
ansible.builtin.include_tasks: "{{ with_first_found_item }}"
|
||||
with_first_found:
|
||||
- "tools-{{ ansible_facts['distribution'] }}.yml"
|
||||
- "tools-{{ (override_os_family is defined) | ternary(override_os_family, ansible_facts['os_family']) }}.yml"
|
||||
loop_control:
|
||||
loop_var: with_first_found_item
|
||||
|
|
|
|||
|
|
@ -2,8 +2,10 @@
|
|||
# Common/Update: Install All Updates
|
||||
|
||||
- name: Update - Update and upgrade all packages
|
||||
ansible.builtin.include_tasks: "{{ item }}"
|
||||
ansible.builtin.include_tasks: "{{ with_first_found_item }}"
|
||||
with_first_found:
|
||||
- "update-{{ ansible_facts['distribution'] }}.yml"
|
||||
- "update-{{ (override_os_family is defined) | ternary(override_os_family, ansible_facts['os_family']) }}.yml"
|
||||
loop_control:
|
||||
loop_var: with_first_found_item
|
||||
ignore_errors: true
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@
|
|||
# Will run once per user, because of lockfile `~/.ansbl-common-usersetup`
|
||||
|
||||
- name: Usersetup - Run setup tasks
|
||||
ansible.builtin.include_tasks: "{{ item }}"
|
||||
ansible.builtin.include_tasks: "{{ with_first_found_item }}"
|
||||
with_first_found:
|
||||
- "usersetup-{{ ansible_facts['distribution'] }}.yml"
|
||||
- "usersetup-{{ (override_os_family is defined) | ternary(override_os_family, ansible_facts['os_family']) }}.yml"
|
||||
loop_control:
|
||||
loop_var: with_first_found_item
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
# Common/Usertools: User's Main Machine/ Developer Tools (nmap, rsync, icdiff, iftop, ansible)
|
||||
|
||||
- name: Usertools - Install user's working utilities
|
||||
ansible.builtin.include_tasks: "{{ item }}"
|
||||
ansible.builtin.include_tasks: "{{ with_first_found_item }}"
|
||||
with_first_found:
|
||||
- "usertools-{{ ansible_facts['distribution'] }}.yml"
|
||||
- "usertools-{{ (override_os_family is defined) | ternary(override_os_family, ansible_facts['os_family']) }}.yml"
|
||||
loop_control:
|
||||
loop_var: with_first_found_item
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue