cli-standardization/roles/claude_code/tasks/main.yml
Travis Herbranson 06034dec95 Add workstation playbook — consolidates arch_custom + manjaro-laptop
New roles:
- workstation: Arch base (yay, UV, Hyprland, tiling tools, fonts,
  productivity apps, NVIDIA auto-detect, tmux + TPM)
- dev_apps: optional dev tools (PyCharm, R/RStudio, databases)
- claude_code: Claude Code CLI install/update via npm
- user_bootstrap: fresh machine user setup (SSH key, sudo)

CLI/shell/terminal setup excluded — handled by existing cli_modern role.
workstation.yml runs cli_modern first, then workstation roles in phases.
All roles tagged for selective deployment.

Passes ansible-lint at production level.
2026-05-02 18:38:01 -04:00

40 lines
1.2 KiB
YAML

---
# claude_code — install Claude Code CLI via npm
- name: Check if Claude Code is installed
ansible.builtin.command: npm list -g @anthropic-ai/claude-code
register: claude_code_check
changed_when: false
failed_when: false
become: true
become_user: "{{ ansible_user }}"
- name: Install Claude Code globally
ansible.builtin.command: npm install -g @anthropic-ai/claude-code
become: true
become_user: "{{ ansible_user }}"
when: claude_code_check.rc != 0
register: claude_code_install
changed_when: claude_code_install.rc == 0
- name: Update Claude Code if already installed
ansible.builtin.command: npm update -g @anthropic-ai/claude-code
become: true
become_user: "{{ ansible_user }}"
when: claude_code_check.rc == 0
register: claude_code_update
changed_when: "'up to date' not in claude_code_update.stdout"
- name: Verify Claude Code installation
ansible.builtin.command: claude --version
register: claude_code_version
changed_when: false
failed_when: false
become: true
become_user: "{{ ansible_user }}"
- name: Display Claude Code version
ansible.builtin.debug:
msg: "Claude Code {{ claude_code_version.stdout | default('not found') }}"
when: claude_code_version is defined