# tasks file for common - name: Check for legacy zshrc content shell: | if grep -q "^# ~/.zshrc" "{{ archsetup_user_home }}/.zshrc" 2>/dev/null; then echo "1" else echo "0" fi register: legacy_check changed_when: false - name: Clean legacy zshrc content replace: path: "{{ archsetup_user_home }}/.zshrc" regexp: '^# ~/.zshrc.*\n' replace: '' when: legacy_check.stdout | int > 0 - name: Install base development tools become: true pacman: name: - base-devel - git - curl - wget - rsync - unzip - zip - less - man - texinfo - which - zsh - stow - ansible - zoxide - atuin - broot - bottom - hyperfine - tokei - git-delta - yazi - tealdeer state: present - name: Install Rust toolchain and Python uv become: true pacman: name: - rust - eza - bat - ripgrep - fd - starship - cargo - cargo-binstall - uv state: present - name: Install Fonts become: true pacman: name: - ttf-dejavu - ttf-liberation - ttf-jetbrains-mono-nerd - adobe-source-han-sans-jp-fonts state: present notify: Update font cache - name: Ensure ttf-joypixels is installed from AUR kewlfft.aur.aur: name: ttf-joypixels use: "{{ aur_helper | default('paru') }}" state: present notify: Update font cache - name: Install AUR helper (paru) shell: | command -v paru >/dev/null 2>&1 && exit 0 || ( cd /tmp rm -rf paru git clone https://aur.archlinux.org/paru.git cd paru makepkg -si --noconfirm cd ~ rm -rf /tmp/paru ) register: paru_install changed_when: "'Installing' in paru_install.stdout or 'Compiling' in paru_install.stdout" - name: Install oh-my-zsh shell: | [ -d ~/.oh-my-zsh ] && exit 0 || sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended args: creates: ~/.oh-my-zsh - name: Check current shell become: true getent: database: passwd key: "{{ archsetup_user }}" register: user_info changed_when: false - name: Set zsh as default shell become: true command: chsh -s /bin/zsh {{ archsetup_user }} when: user_info.ansible_facts.getent_passwd[archsetup_user][-1] != '/bin/zsh' - name: Setup shell profile configuration blockinfile: path: "{{ archsetup_user_home }}/.profile" marker: "# {mark} ANSIBLE MANAGED BLOCK" create: yes mode: '0644' block: | # Rust and cargo binaries export PATH="$HOME/.cargo/bin:$HOME/.local/bin:$PATH" # XDG Base Directory export XDG_CONFIG_HOME="$HOME/.config" export XDG_DATA_HOME="$HOME/.local/share" export XDG_CACHE_HOME="$HOME/.cache" export EDITOR="emacs -nw" - name: Deploy zshrc base config blockinfile: path: "{{ archsetup_user_home }}/.zshrc" marker: "# {mark} ANSIBLE MANAGED - BASE" block: | # Source .zprofile for login shell environment [[ -f ~/.zprofile ]] && emulate sh -c 'source ~/.zprofile' # Enable oh-my-zsh export ZSH="$HOME/.oh-my-zsh" ZSH_THEME="agnoster" # Plugins plugins=( git history z ) source $ZSH/oh-my-zsh.sh # Initialize starship (must be after oh-my-zsh) eval "$(starship init zsh)" # # Initialize zoxide (must be after oh-my-zsh) eval "$(zoxide init zsh)" # Initialize atuin (must be after oh-my-zsh) eval "$(atuin init zsh)" - name: Deploy zshrc history config blockinfile: path: "{{ archsetup_user_home }}/.zshrc" marker: "# {mark} ANSIBLE MANAGED - HISTORY" block: | # History export HISTSIZE=50000 export SAVEHIST=50000 export HISTTIMEFORMAT="[%F %T] " setopt INC_APPEND_HISTORY setopt EXTENDED_HISTORY setopt HIST_EXPIRE_DUPS_FIRST setopt HIST_IGNORE_DUPS setopt HIST_IGNORE_ALL_DUPS setopt HIST_FIND_NO_DUPS setopt HIST_IGNORE_SPACE setopt HIST_SAVE_NO_DUPS setopt SHARE_HISTORY - name: Deploy zshrc common aliases blockinfile: path: "{{ archsetup_user_home }}/.zshrc" marker: "# {mark} ANSIBLE MANAGED - COMMON ALIASES" block: | # Common aliases alias q="exit" alias vim="nvim" alias cat="bat" alias ls="eza --icons" alias ll="eza -l --icons" alias la="eza -la --icons" alias lt="eza --tree --level=2 --icons" alias df="df -h" alias wttr="curl wttr.in/Essen"