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>
88 lines
3 KiB
YAML
88 lines
3 KiB
YAML
---
|
|
- name: Verify
|
|
hosts: all
|
|
become: true
|
|
gather_facts: false
|
|
tasks:
|
|
- name: Gather installed-package facts
|
|
ansible.builtin.package_facts:
|
|
manager: apt
|
|
|
|
- name: Assert core packages are present
|
|
ansible.builtin.assert:
|
|
that:
|
|
- "'zsh' in ansible_facts.packages"
|
|
- "'tmux' in ansible_facts.packages"
|
|
- "'stow' in ansible_facts.packages"
|
|
- "'direnv' in ansible_facts.packages"
|
|
fail_msg: core dev_env packages missing
|
|
|
|
- name: Stat system binaries and theme
|
|
ansible.builtin.stat:
|
|
path: "{{ item }}"
|
|
loop:
|
|
- /usr/local/bin/nvim
|
|
- /usr/local/bin/oh-my-posh
|
|
- /usr/local/bin/node
|
|
- /usr/local/bin/npm
|
|
- /etc/oh-my-posh/zen.toml
|
|
register: dev_env__sys
|
|
loop_control:
|
|
label: "{{ item }}"
|
|
|
|
- name: Assert system tools are installed
|
|
ansible.builtin.assert:
|
|
that:
|
|
- dev_env__sys.results | map(attribute='stat.exists') | min
|
|
fail_msg: a system tool (nvim/oh-my-posh/node/npm/zen.toml) is missing
|
|
|
|
- name: Look up the test user
|
|
ansible.builtin.getent:
|
|
database: passwd
|
|
key: tester
|
|
|
|
- name: Assert tester login shell is zsh
|
|
ansible.builtin.assert:
|
|
that:
|
|
- "getent_passwd['tester'][5] == '/usr/bin/zsh'"
|
|
fail_msg: tester login shell was not set to zsh
|
|
|
|
- name: Stat tester dotfiles and frameworks
|
|
ansible.builtin.stat:
|
|
path: "{{ item }}"
|
|
loop:
|
|
- /home/tester/.zshrc
|
|
- /home/tester/.tmux.conf
|
|
- /home/tester/.config/nvim/init.lua
|
|
- /home/tester/.oh-my-zsh
|
|
- /home/tester/.tmux/plugins/tpm
|
|
register: dev_env__dots
|
|
loop_control:
|
|
label: "{{ item }}"
|
|
|
|
- name: Assert dotfiles are stowed (symlinks) and frameworks cloned
|
|
ansible.builtin.assert:
|
|
that:
|
|
- dev_env__dots.results[0].stat.exists
|
|
- dev_env__dots.results[0].stat.islnk
|
|
- dev_env__dots.results[1].stat.exists
|
|
- dev_env__dots.results[1].stat.islnk
|
|
- dev_env__dots.results[2].stat.exists
|
|
- dev_env__dots.results[3].stat.exists
|
|
- dev_env__dots.results[4].stat.exists
|
|
fail_msg: dotfiles not stowed or omz/tpm not cloned
|
|
|
|
# Partial-tags regression guard (O8): the config-only converge play provisioned
|
|
# `tagtester`. Its stowed .zshrc proves dev_env__home resolved (the `always` preflight)
|
|
# and stow (a `config` task) ran without the `users`/`packages` concerns.
|
|
- name: Stat the config-only user's stowed .zshrc
|
|
ansible.builtin.stat:
|
|
path: /home/tagtester/.zshrc
|
|
register: dev_env__tagtester_zshrc
|
|
|
|
- name: Assert the config concern alone resolved home and stowed dotfiles
|
|
ansible.builtin.assert:
|
|
that:
|
|
- dev_env__tagtester_zshrc.stat.exists
|
|
- dev_env__tagtester_zshrc.stat.islnk
|
|
fail_msg: config-only run did not resolve dev_env__home / stow dotfiles for tagtester
|