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>
74 lines
2.3 KiB
YAML
74 lines
2.3 KiB
YAML
---
|
|
# `always`: dev_env__home must resolve on every entry into per_user.yml, including a
|
|
# partial `--tags users` or `--tags config` run — the dotfile/stow (config) and login-shell
|
|
# (users) tasks below all depend on it, so it must never be filtered out (ADR-019).
|
|
- name: Look up account for {{ dev_env__user }}
|
|
ansible.builtin.getent:
|
|
database: passwd
|
|
key: "{{ dev_env__user }}"
|
|
tags: [always]
|
|
|
|
- name: Resolve home directory for {{ dev_env__user }}
|
|
ansible.builtin.set_fact:
|
|
dev_env__home: "{{ getent_passwd[dev_env__user][4] }}"
|
|
tags: [always]
|
|
|
|
- name: Set login shell to zsh for {{ dev_env__user }}
|
|
ansible.builtin.user:
|
|
name: "{{ dev_env__user }}"
|
|
shell: /usr/bin/zsh
|
|
tags: [users]
|
|
|
|
- name: Clone oh-my-zsh for {{ dev_env__user }}
|
|
become: true
|
|
become_user: "{{ dev_env__user }}"
|
|
ansible.builtin.git:
|
|
repo: https://github.com/ohmyzsh/ohmyzsh.git
|
|
dest: "{{ dev_env__home }}/.oh-my-zsh"
|
|
version: master
|
|
depth: 1
|
|
update: false
|
|
|
|
- name: Clone oh-my-zsh custom plugins for {{ dev_env__user }}
|
|
become: true
|
|
become_user: "{{ dev_env__user }}"
|
|
ansible.builtin.git:
|
|
repo: "{{ item.repo }}"
|
|
dest: "{{ dev_env__home }}/.oh-my-zsh/custom/plugins/{{ item.name }}"
|
|
version: master
|
|
depth: 1
|
|
update: false
|
|
loop: "{{ dev_env__omz_custom_plugins }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
|
|
- name: Clone tmux plugins (incl. TPM) for {{ dev_env__user }}
|
|
become: true
|
|
become_user: "{{ dev_env__user }}"
|
|
ansible.builtin.git:
|
|
repo: "{{ item.repo }}"
|
|
dest: "{{ dev_env__home }}/.tmux/plugins/{{ item.name }}"
|
|
version: "{{ item.version }}"
|
|
depth: 1
|
|
update: false
|
|
loop: "{{ dev_env__tmux_plugins }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
|
|
- name: Install dotfiles into ~/.dotfiles for {{ dev_env__user }}
|
|
become: true
|
|
become_user: "{{ dev_env__user }}"
|
|
ansible.builtin.copy:
|
|
src: dotfiles/
|
|
dest: "{{ dev_env__home }}/.dotfiles/"
|
|
mode: preserve
|
|
tags: [config]
|
|
|
|
- name: Stow dotfiles into home for {{ dev_env__user }}
|
|
become: true
|
|
become_user: "{{ dev_env__user }}"
|
|
ansible.builtin.command:
|
|
cmd: "stow --no-folding -v -d {{ dev_env__home }}/.dotfiles -t {{ dev_env__home }} zsh tmux nvim"
|
|
register: dev_env__stow
|
|
changed_when: "'LINK:' in dev_env__stow.stderr or 'LINK:' in dev_env__stow.stdout"
|
|
tags: [config]
|