--- # playbook.yml - Ansible playbook for Arch Linux development environment setup - name: Arch Linux Development Environment Setup hosts: localhost gather_facts: yes connection: local become: yes vars: username: "{{ lookup('env', 'USER') }}" user_home: "/home/{{ username }}" git_server_port: 3000 install_tiling_wm: true # Set to false if you don't want a tiling WM tiling_wm: "i3-gaps" # Options: i3-gaps, sway, awesome, qtile, bspwm tasks: # Update system packages - name: Update system packages pacman: update_cache: yes upgrade: yes # Install essential development packages - name: Install development essentials pacman: name: - base-devel - git - curl - wget - openssh - python - python-pip - hyprland state: present # Install AUR helper (yay) - name: Check if yay is installed command: which yay register: yay_installed changed_when: false failed_when: false - name: Install yay (AUR helper) when: yay_installed.rc != 0 become: no block: - name: Clone yay repository git: repo: https://aur.archlinux.org/yay.git dest: "{{ user_home }}/yay" - name: Build and install yay command: makepkg -si --noconfirm args: chdir: "{{ user_home }}/yay" - name: Clean up yay build directory file: path: "{{ user_home }}/yay" state: absent # Install terminal emulator - Alacritty - name: Install Alacritty terminal pacman: name: - alacritty state: present # Configure Alacritty - name: Create Alacritty config directory become: no file: path: "{{ user_home }}/.config/alacritty" state: directory mode: '0755' - name: Install Nerd Font for Alacritty become: no command: yay -S --noconfirm ttf-firacode-nerd register: font_result changed_when: font_result.rc == 0 failed_when: font_result.rc != 0 and 'error' in font_result.stderr - name: Configure Alacritty become: no copy: dest: "{{ user_home }}/.config/alacritty/alacritty.yml" content: | # Performance env: TERM: xterm-256color # Appearance window: padding: x: 10 y: 10 dynamic_padding: true decorations: full opacity: 0.95 # Slight transparency # Font configuration font: normal: family: FiraCode Nerd Font style: Regular bold: style: Bold italic: style: Italic size: 12.0 offset: x: 0 y: 0 glyph_offset: x: 0 y: 0 use_thin_strokes: true # Colors (Dracula theme) colors: primary: background: '#282a36' foreground: '#f8f8f2' cursor: text: '#44475a' cursor: '#f8f8f2' selection: https://github.com/mylinuxforwork/hyprland-starter text: '#f8f8f2' background: '#44475a' # Shell integration shell: program: /bin/zsh # Keybindings for productivity key_bindings: - { key: V, mods: Control|Shift, action: Paste } - { key: C, mods: Control|Shift, action: Copy } - { key: N, mods: Control|Shift, action: SpawnNewInstance } - { key: Key0, mods: Control, action: ResetFontSize } - { key: Plus, mods: Control, action: IncreaseFontSize } - { key: Minus, mods: Control, action: DecreaseFontSize } mode: '0644' # Install VS Code - name: Install VS Code pacman: name: - code state: present # Install VS Code extensions - name: Install VS Code extensions become: no command: code --install-extension {{ item }} loop: - redhat.ansible - ms-azuretools.vscode-docker - ms-kubernetes-tools.vscode-kubernetes-tools - hashicorp.terraform register: vscode_ext_result changed_when: "'already installed' not in vscode_ext_result.stdout" # Install PyCharm Professional - name: Install PyCharm Professional become: no command: yay -S --noconfirm pycharm-professional register: pycharm_result changed_when: pycharm_result.rc == 0 failed_when: pycharm_result.rc != 0 and 'error' in pycharm_result.stderr # Install UV package manager - name: Install UV package manager become: no command: yay -S --noconfirm uv register: uv_result changed_when: uv_result.rc == 0 failed_when: uv_result.rc != 0 and 'error' in uv_result.stderr # Configure UV - name: Create UV config directory become: no file: path: "{{ user_home }}/.config/uv" state: directory mode: '0755' - name: Create UV config file become: no copy: dest: "{{ user_home }}/.config/uv/uv.toml" content: | default-python = "python3" mode: '0644' # Install Gitea for local Git server # - name: Install Gitea # pacman: # name: # - gitea # state: present # - name: Create Gitea config directory # file: # path: /etc/gitea # state: directory # mode: '0755' # - name: Configure Gitea # copy: # remote_src: yes # src: /etc/gitea/app.example.ini # dest: /etc/gitea/app.ini # force: no # - name: Update Gitea configuration # lineinfile: # path: /etc/gitea/app.ini # regexp: '^HTTP_PORT' # line: 'HTTP_PORT = {{ git_server_port }}' # - name: Enable and start Gitea service # systemd: # name: gitea # enabled: yes # state: started # Install Docker - name: Install Docker pacman: name: - docker state: present - name: Enable and start Docker service systemd: name: docker enabled: yes state: started - name: Add user to docker group user: name: "{{ username }}" groups: docker append: yes # Install additional data analysis tools - name: Install R (optional) pacman: name: - r state: present - name: Install RStudio (optional) become: no command: yay -S --noconfirm rstudio-desktop-bin register: rstudio_result changed_when: rstudio_result.rc == 0 failed_when: rstudio_result.rc != 0 and 'error' in rstudio_result.stderr # Install database tools - name: Install database tools pacman: name: - postgresql - mariadb - mongodb state: present - name: Install powerlevel10k theme become: no git: repo: https://github.com/mylinuxforwork/hyprland-starter dest: "{{ user_home }}/hyprland-started" depth: 1 register: hyprland-starter_installed # Install Zsh and Oh My Zsh - name: Install Zsh pacman: name: - zsh state: present # Install Fish shell - name: Install Fish shell pacman: name: - fish state: present # Install powerlevel10k - name: Install powerlevel10k theme become: no git: repo: https://github.com/romkatv/powerlevel10k.git dest: "{{ user_home }}/.oh-my-zsh/custom/themes/powerlevel10k" depth: 1 register: p10k_installed - name: Check if Oh My Zsh is installed become: no stat: path: "{{ user_home }}/.oh-my-zsh" register: oh_my_zsh_installed - name: Install Oh My Zsh become: no when: not oh_my_zsh_installed.stat.exists shell: curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh | sh args: creates: "{{ user_home }}/.oh-my-zsh" - name: Configure powerlevel10k theme in zshrc become: no lineinfile: path: "{{ user_home }}/.zshrc" regexp: '^ZSH_THEME=' line: 'ZSH_THEME="powerlevel10k/powerlevel10k"' # Install tiling window manager if enabled - name: Install tiling window manager when: install_tiling_wm pacman: name: - "{{ tiling_wm }}" - rofi # Application launcher - dunst # Notifications - picom # Compositor - feh # Wallpaper manager - sxhkd # Hotkey daemon - lxappearance - i3status - i3clock - dmenu - i3status - i3lock - dmenu - i3-gaps state: present # Install common development tools - name: Install productivity tools pacman: name: - flameshot # Screenshot tool - meld # Diff tool - zeal # Offline documentation - tmux # Terminal multiplexer - btop # System monitoring - ranger # File manager - timeshift # System backups - syncthing # File synchronization - keepassxc # Password manager state: present # Install common fonts - name: Install additional fonts pacman: name: - ttf-dejavu - ttf-liberation - noto-fonts - noto-fonts-emoji state: present # Add GPU support for ML/LLM (NVIDIA) - name: Check for NVIDIA GPU shell: lspci | grep -i nvidia register: has_nvidia changed_when: false failed_when: false - name: Install NVIDIA CUDA support when: has_nvidia.rc == 0 pacman: name: - cuda - cudnn state: present # Create projects directory structure - name: Create project directories become: no file: path: "{{ user_home }}/projects/{{ item }}" state: directory mode: '0755' loop: - llm-dev - app-dev - data-analysis # Set Alacritty as default terminal (if installed) - name: Set Alacritty as default terminal become: no command: xdg-mime default alacritty.desktop x-scheme-handler/terminal changed_when: false failed_when: false # Notify user about completion - name: Display completion message debug: msg: | Development environment setup complete! Access your local Git server at: http://localhost:{{ git_server_port }} Remember to log out and back in for the docker group changes to take effect. Python environments were not created as requested - use the following commands to set them up: cd ~/projects/llm-dev uv venv source .venv/bin/activate uv pip install torch transformers datasets huggingface_hub Shells setup: - ZSH with Powerlevel10k theme is installed - Fish shell is also available, switch to it by typing 'fish' Terminal: - Alacritty has been configured as your terminal emulator {% if install_tiling_wm %} Window Manager: - {{ tiling_wm }} has been installed as your tiling window manager {% endif %}