Signed-off-by: Tuan-Dat Tran <tuan-dat.tran@tudattr.dev>
This commit is contained in:
Tuan-Dat Tran
2026-03-22 22:51:32 +01:00
commit 222062c1a4
17 changed files with 1154 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
- name: Update font cache
ansible.builtin.command: fc-cache -fv
changed_when: false

138
roles/common/tasks/main.yml Normal file
View File

@@ -0,0 +1,138 @@
# tasks file for common
- 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: 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: "{{ user }}"
register: user_info
changed_when: false
- name: Set zsh as default shell
become: true
shell: chsh -s /bin/zsh {{ user }}
when: user_info.ansible_facts.getent_passwd[user][-1] != '/bin/zsh'
- name: Setup shell profile configuration
blockinfile:
path: "{{ lookup('env', 'HOME') }}/.profile"
marker: "# {mark} ANSIBLE MANAGED BLOCK"
create: yes
mode: '0644'
content: |
# ~/.profile - POSIX compatible environment
# 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: Setup zprofile for Zsh compatibility
copy:
dest: "{{ lookup('env', 'HOME') }}/.zprofile"
content: |
# ~/.zprofile - Sourced by Zsh for login shells
# Source .profile for POSIX-compatible environment
emulate sh -c 'source ~/.profile'
# Initialize zoxide for smart cd
eval "$(zoxide init zsh)"
# Initialize atuin for shell history
eval "$(atuin init zsh)"
owner: "{{ lookup('env', 'USER') }}"
mode: '0644'
- name: Setup shell plugins in zshrc
blockinfile:
path: "{{ lookup('env', 'HOME') }}/.zshrc"
marker: "# {mark} ANSIBLE MANAGED BLOCK"
content: |
# Source .zprofile for login shell environment
[[ -f ~/.zprofile ]] && emulate sh -c 'source ~/.zprofile'