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

6
roles/ai/tasks/main.yaml Normal file
View File

@@ -0,0 +1,6 @@
# tasks file for ai
- name: Install AI development tools
pacman:
name:
- opencode
state: present

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'

View File

@@ -0,0 +1,53 @@
# tasks file for cs_student
- name: Install CS student tools
become: true
pacman:
name:
- neovim
- emacs
- python
- nodejs
- npm
- texlive-bin
- texlive-basic
- jupyter-nbconvert
- docker
- code
- github-cli
state: present
- name: Install LazyVim
shell: |
[ -d ~/.config/lazyvim ] && rm -rf ~/.config/lazyvim
git clone https://github.com/LazyVim/starter ~/.config/lazyvim
rm -rf ~/.config/lazyvim/.git
args:
creates: ~/.config/lazyvim
- name: Configure neovim to use LazyVim
shell: |
ln -sf ~/.config/lazyvim ~/.config/nvim
args:
creates: ~/.config/nvim
- name: Install Spacemacs
shell: |
[ -d ~/.emacs.d ] && rm -rf ~/.emacs.d
git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d -b develop
args:
creates: ~/.emacs.d
- name: Setup shell aliases
lineinfile:
path: "{{ lookup('env', 'HOME') }}/.zshrc"
line: "{{ item }}"
create: yes
loop:
- alias ls='eza --icons --group-directories-first'
- alias ll='eza -la --icons --group-directories-first'
- alias cat='bat --style=auto'
- alias find='fd'
- alias top='btm'
- alias tre='broot --sizes'
- alias e='emacs -nw'
- alias vim='nvim'

11
roles/ctf/tasks/main.yml Normal file
View File

@@ -0,0 +1,11 @@
# tasks file for ctf
- name: Install CTF tools (official repos)
become: true
pacman:
name:
- wireshark-qt
- nmap
- openbsd-netcat
- binwalk
- gobuster
state: present

View File

@@ -0,0 +1,24 @@
# tasks file for devops
- name: Install DevOps tools
become: true
pacman:
name:
- docker
- kubectl
- terraform
- ansible
- helm
- k9s
- pulumi
- kubectx
state: present
- name: Setup shell aliases
lineinfile:
path: "{{ lookup('env', 'HOME') }}/.zshrc"
line: "{{ item }}"
create: yes
loop:
- alias kc='kubectl'
- alias kctx='kubectx'
- alias kns='kubens'

View File

@@ -0,0 +1,23 @@
# tasks file for dotfiles
- name: Ensure stow is installed
become: true
pacman:
name:
- stow
state: present
- name: Remove existing config files before stowing
shell: |
[ -L ~/.config/hypr/hyprland.conf ] || rm -f ~/.config/hypr/hyprland.conf
[ -L ~/.config/starship ] || rm -rf ~/.config/starship
[ -L ~/.config/zellij ] || rm -rf ~/.config/zellij
changed_when: false
- name: Create symlinks with stow
shell: |
cd {{ lookup('env', 'HOME') }}/archsetup/dotfiles
stow -t ~ hypr starship zellij
args:
executable: /bin/bash
creates: "{{ lookup('env', 'HOME') }}/.config/starship"
chdir: "{{ lookup('env', 'HOME') }}/archsetup/dotfiles"

View File

@@ -0,0 +1,81 @@
# tasks file for hyprland
- name: Install Hyprland and desktop components (official repos)
become: true
pacman:
name:
- waybar
- wofi
- kitty
- swaync
- fastfetch
- hyprpaper
- hyprlock
- pavucontrol
- brightnessctl
- playerctl
- grim
- wl-clipboard
- xdg-desktop-portal-hyprland
- zellij
- veracrypt
state: present
- name: Install basic Linux tools
become: true
pacman:
name:
- fzf
- jq
- yq
- shellcheck
- dust
- ffmpeg
- sxiv
- pandoc
- p7zip
- entr
- less
- man
- texinfo
- which
- iw
- network-manager-applet
- udiskie
- ntfs-3g
state: present
- name: Install Bluetooth support
become: true
pacman:
name:
- bluez
- bluez-utils
- bluedevil
state: present
- name: Install printing support
become: true
pacman:
name:
- cups
- cups-pdf
- system-config-printer
state: present
- name: Enable services
become: true
systemd:
name: "{{ item }}"
enabled: yes
loop:
- bluetooth
- cups
- docker
- udisks2
- name: Add user to docker group
become: true
user:
name: "{{ user }}"
groups: docker
append: yes