cli-standardization/roles/workstation/tasks/main.yml
2026-05-02 19:23:37 -04:00

202 lines
5.9 KiB
YAML

---
# workstation — Arch Linux base system setup
# Handles: system packages, yay (AUR), UV, Hyprland, tiling WM tools,
# fonts, productivity apps, NVIDIA, tmux.
# Does NOT handle: shell, prompt, CLI tools (that's cli_modern).
- name: Update system packages
community.general.pacman:
update_cache: true
upgrade: true
- name: Install base development packages
community.general.pacman:
name:
- base-devel
- git
- tea
- curl
- wget
- openssh
state: present
# ── yay (AUR helper) ────────────────────────────────────────────────────
- name: Check if yay is installed
ansible.builtin.command: which yay
register: workstation_yay_check
changed_when: false
failed_when: false
- name: Install yay
when: workstation_install_yay and workstation_yay_check.rc != 0
become: true
become_user: "{{ workstation_user }}"
block:
- name: Clone yay repository
ansible.builtin.git:
repo: https://aur.archlinux.org/yay.git
dest: "{{ workstation_user_home }}/yay"
clone: true
version: master
- name: Build and install yay
ansible.builtin.shell: cd "{{ workstation_user_home }}/yay" && makepkg -si --noconfirm
register: workstation_yay_build
changed_when: workstation_yay_build.rc == 0
- name: Clean up yay build directory
ansible.builtin.file:
path: "{{ workstation_user_home }}/yay"
state: absent
# ── UV package manager ──────────────────────────────────────────────────
- name: Install UV via yay
become: true
become_user: "{{ workstation_user }}"
ansible.builtin.command: yay -S --noconfirm uv
register: workstation_uv_result
changed_when: "'installing' in workstation_uv_result.stdout | default('')"
failed_when: false
when: workstation_install_uv
- name: Create UV config directory
become: true
become_user: "{{ workstation_user }}"
ansible.builtin.file:
path: "{{ workstation_user_home }}/.config/uv"
state: directory
mode: "0755"
when: workstation_install_uv
# ── Hyprland ────────────────────────────────────────────────────────────
- name: Install Hyprland
community.general.pacman:
name: hyprland
state: present
when: workstation_install_hyprland
- name: Check if hyprland-starter is already cloned
become: true
become_user: "{{ workstation_user }}"
ansible.builtin.stat:
path: "{{ workstation_user_home }}/hyprland-starter"
register: workstation_hyprland_dir
- name: Clone hyprland-starter
become: true
become_user: "{{ workstation_user }}"
ansible.builtin.git:
repo: https://github.com/mylinuxforwork/hyprland-starter
dest: "{{ workstation_user_home }}/hyprland-starter"
depth: 1
version: main
when: workstation_install_hyprland and not workstation_hyprland_dir.stat.exists
# ── Tiling WM tools ────────────────────────────────────────────────────
- name: Install tiling WM tools
community.general.pacman:
name:
- rofi
- dunst
- picom
- feh
- sxhkd
- lxappearance
- i3status
- dmenu
- i3lock
state: present
when: workstation_install_tiling_tools
# ── Fonts ───────────────────────────────────────────────────────────────
- name: Install fonts
community.general.pacman:
name:
- ttf-dejavu
- ttf-liberation
- noto-fonts
- noto-fonts-emoji
state: present
when: workstation_install_fonts
- name: Install Nerd Font via yay
become: true
become_user: "{{ workstation_user }}"
ansible.builtin.command: yay -S --noconfirm ttf-firacode-nerd
register: workstation_nerd_font
changed_when: "'installing' in workstation_nerd_font.stdout | default('')"
failed_when: false
when: workstation_install_fonts
# ── Productivity tools ──────────────────────────────────────────────────
- name: Install productivity tools
community.general.pacman:
name:
- flameshot
- meld
- zeal
- btop
- ranger
- timeshift
- syncthing
- keepassxc
- zellij
- sshs
- dust
- duf
- procs
- fd
- lazygit
- delta
- gh
- tig
- tealdeer
- glow
- gum
- thunderbird
- keepassxc
- vlc
- spotify
- gimp
- flameshot
- tailscale
- gparted
- timeshift
- rclone
- zen-browser-bin
- chromium
state: present
when: workstation_install_productivity
# ── NVIDIA ──────────────────────────────────────────────────────────────
- name: Check for NVIDIA GPU
ansible.builtin.command: lspci
register: workstation_lspci
changed_when: false
failed_when: false
when: workstation_install_nvidia == "auto" or workstation_install_nvidia | bool
- name: Set NVIDIA detected fact
ansible.builtin.set_fact:
workstation_has_nvidia: "{{ 'NVIDIA' in (workstation_lspci.stdout | default('') | upper) }}"
- name: Install NVIDIA CUDA support
community.general.pacman:
name:
- cuda
- cudnn
state: present
when: >
(workstation_install_nvidia == "auto" and workstation_has_nvidia | bool) or
(workstation_install_nvidia | bool and workstation_install_nvidia != "auto")