Dynamic include_tasks only filter on the include's own tags, not their (untagged) contents — so `--tags packages` ran none of the neovim/oh-my-posh/ nodejs installs, and `--tags users|config` never entered per_user.yml. Add `apply: tags:` to all four includes (mirroring base/tasks/main.yml) and tag the dev_env__home getent+set_fact preflight `always` so a partial run still resolves the home dir before the dotfile/stow tasks consume it. Molecule: add a config-only converge play for a fresh user + a verify assertion. Proven with `molecule converge -- --tags config` (idempotent, home resolved). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
46 lines
1.4 KiB
YAML
46 lines
1.4 KiB
YAML
---
|
|
- name: Install developer-environment packages
|
|
ansible.builtin.apt:
|
|
name: "{{ dev_env__packages }}"
|
|
state: present
|
|
update_cache: true
|
|
cache_valid_time: 3600
|
|
tags: [packages]
|
|
|
|
# `apply: tags:` propagates the concern tag onto the INCLUDED tasks — without it a tag on
|
|
# a dynamic include_tasks only selects the include itself, not its (untagged) contents, so
|
|
# `--tags <concern>` would run nothing (Ansible gotcha; mirrors roles/base/tasks/main.yml).
|
|
- name: Install Neovim (pinned release)
|
|
ansible.builtin.include_tasks:
|
|
file: neovim.yml
|
|
apply:
|
|
tags: [packages]
|
|
tags: [packages]
|
|
|
|
- name: Install oh-my-posh prompt (pinned release)
|
|
ansible.builtin.include_tasks:
|
|
file: oh_my_posh.yml
|
|
apply:
|
|
tags: [packages]
|
|
tags: [packages]
|
|
|
|
- name: Install Node.js (pinned release)
|
|
ansible.builtin.include_tasks:
|
|
file: nodejs.yml
|
|
apply:
|
|
tags: [packages]
|
|
tags: [packages]
|
|
|
|
# per_user.yml resolves dev_env__home (tagged `always`, below) then runs both the `users`
|
|
# (login shell) and `config` (dotfiles/stow) concerns; tag + apply both so either
|
|
# `--tags users` or `--tags config` reaches in and the home-dir preflight always runs.
|
|
- name: Configure each developer user
|
|
ansible.builtin.include_tasks:
|
|
file: per_user.yml
|
|
apply:
|
|
tags: [users, config]
|
|
loop: "{{ dev_env__users }}"
|
|
loop_control:
|
|
loop_var: dev_env__user
|
|
label: "{{ dev_env__user }}"
|
|
tags: [users, config]
|