cli-standardization/roles/workstation/tasks/main.yml

261 lines
7.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
- name: Remove conflicting tldr (Python) before tealdeer install
community.general.pacman:
name: tldr
state: absent
become: true
# ── Productivity tools ──────────────────────────────────────────────────
- name: Install official repo packages
community.general.pacman:
name:
- flameshot
- meld
- btop
- ranger
- syncthing
- keepassxc
- zellij
- dust
- duf
- procs
- fd
- lazygit
- git-delta
- github-cli
- tig
- tealdeer
- glow
- gum
- thunderbird
- vlc
- gimp
- tailscale
- gparted
- rclone
- chromium
- ghostty
state: present
become: true
# - name: Install AUR packages
# kewlfft.aur.aur:
# name:
# - zeal
# - sshs
# - spotify
# - timeshift
# - zen-browser-bin
# - devenv
# - ansible
# - ghostty
# use: yay
# state: present
# become_user: "{{ workstation_user }}"
- name: Register reminder — Ghostty Ctrl+Alt+T shortcut
set_fact:
post_install_reminders: "{{ post_install_reminders | default([]) + [reminder] }}"
vars:
reminder:
title: "Ghostty Ctrl+Alt+T shortcut"
steps:
- "System Settings → Shortcuts → Custom Shortcuts"
- "Add new → Global Shortcut → Command/URL"
- "Trigger: Ctrl+Alt+T"
- "Action: bash -c 'kdotool search --class ghostty windowactivate || ghostty'"
- name: Register reminder — Set Fish as default shell
set_fact:
post_install_reminders: "{{ post_install_reminders | default([]) + [reminder] }}"
vars:
reminder:
title: "Set Fish as default shell"
steps:
- "Run: chsh -s /usr/bin/fish"
- "Log out / back in"
- name: Register reminder — Install AUR packages manually
set_fact:
post_install_reminders: "{{ post_install_reminders | default([]) + [reminder] }}"
vars:
reminder:
title: "Install AUR packages manually"
steps:
- "Run: yay -S zeal sshs spotify timeshift zen-browser-bin devenv ansible ghostty"
- "Or one at a time if you want to review each PKGBUILD"
- name: Register reminder — Configure Timeshift
set_fact:
post_install_reminders: "{{ post_install_reminders | default([]) + [reminder] }}"
vars:
reminder:
title: "Configure Timeshift snapshots"
steps:
- "Run: sudo timeshift-gtk"
- "Select snapshot type (RSYNC for ext4, BTRFS if applicable)"
- "Choose snapshot location (separate disk recommended)"
- "Set schedule: Daily=5, Weekly=3, Monthly=2 (or your preference)"
- "Exclude /home from snapshots (system snapshots only)"
- "Run first manual snapshot to verify config"
# ── 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")