Cross-platform development environment setup using Ansible. Supports Ubuntu, Debian, Fedora, and macOS.
TechDufus was a huge inspiration for this project
Ubuntu/Debian/Kali:
# Update system
sudo apt update && sudo apt upgrade -y
# Install essential tools
sudo apt install -y git curl software-properties-common
# Install Ansible
sudo add-apt-repository --yes --update ppa:ansible/ansible
sudo apt install -y ansible
# Install required Ansible collections
ansible-galaxy collection install community.generalFedora:
# Update system
sudo dnf update -y
# Install essential tools
sudo dnf install -y git curl dnf-plugins-core
# Install Ansible
sudo dnf install -y ansible
# Install required Ansible collections
ansible-galaxy collection install community.generalmacOS:
# Install via Homebrew if you already have it
brew install ansible
# Install required Ansible collections
ansible-galaxy collection install community.general- Clone the repository
git clone https://github.com/PhDbuilds/dotfiles.git
cd dotfiles- Run the full playbook
ansible-playbook main.yml --ask-become-pass- Or run specific roles only
# Install only Neovim and tmux
ansible-playbook main.yml --ask-become-pass --limit localhost --tags "neovim,tmux"- Neovim: Modern Vim-based editor with comprehensive Lua configuration
- tmux: Terminal multiplexer with custom configuration
- zsh: Modern shell with oh-my-zsh
- colorls: Colorized ls command with icons
- Lazygit: Cool git UI util for lazy people
This repository is designed to be the single source of truth for your development environment across all devices. When you want to add a new tool, add it to the dotfiles first, then sync to your machines. This helps from getting config drift, if you are like me and care about that.
- Create a new role for the tool
- Add OS-specific installation tasks
- Add configuration files (if needed)
- Include the role in
main.yml - Commit and push to GitHub
- Pull and run the playbook on any machine to sync
# 1. Create the role structure
mkdir -p roles/lazygit/tasks
mkdir -p roles/lazygit/files # Only if you need config files
# 2. Create the main task file
cat > roles/lazygit/tasks/main.yml << 'EOF'
---
- name: "{{ role_name }} | Run Debian-family tasks"
ansible.builtin.include_tasks: "Debian.yml"
when: ansible_os_family == "Debian"
- name: "{{ role_name }} | Run Darwin tasks"
ansible.builtin.include_tasks: "Darwin.yml"
when: ansible_os_family == "Darwin"
- name: "{{ role_name }} | Run RedHat-family tasks"
ansible.builtin.include_tasks: "RedHat.yml"
when: ansible_os_family == "RedHat"
EOF
# 3. Create OS-specific installation files
cat > roles/lazygit/tasks/Debian.yml << 'EOF'
---
- name: "Lazygit | Debian-family | Add Lazygit PPA (Ubuntu/Debian only)"
ansible.builtin.apt_repository:
repo: ppa:lazygit-team/release
state: present
update_cache: true
become: true
when: ansible_distribution != "Kali"
- name: "Lazygit | Debian-family | Install Lazygit"
ansible.builtin.apt:
name: lazygit
state: present
become: true
EOF
cat > roles/lazygit/tasks/Darwin.yml << 'EOF'
---
- name: "Lazygit | Darwin | Install Lazygit"
community.general.homebrew:
name: lazygit
state: present
EOF
cat > roles/lazygit/tasks/RedHat.yml << 'EOF'
---
- name: "Lazygit | RedHat-family | Add Lazygit COPR repository"
ansible.builtin.command:
cmd: dnf copr enable atim/lazygit -y
become: true
changed_when: false
- name: "Lazygit | RedHat-family | Install Lazygit"
ansible.builtin.dnf:
name: lazygit
state: present
become: true
EOF
# 4. Add the role to main.yml
# Edit main.yml and add under the tasks section:
# - name: Set up Lazygit
# ansible.builtin.include_role:
# name: lazygit
# 5. Test locally first (optional but recommended)
ansible-playbook main.yml --ask-become-pass --tags "lazygit"
# 6. Commit and push your changes
git add roles/lazygit main.yml
git commit -m "Add Lazygit role"
git push origin mainOnce you've pushed your changes to GitHub, syncing to any other machine is simple:
cd dotfiles
git pull origin main
ansible-playbook main.yml --ask-become-passIf your tool needs configuration files (like tmux or zsh), add them to roles/<tool>/files/:
# Example: Adding a Lazygit config
cat > roles/lazygit/files/config.yml << 'EOF'
# Your lazygit configuration here
EOF
# Then in your main.yml for that role, add a task to copy the config:
# - name: "Lazygit | Configure"
# ansible.builtin.copy:
# src: config.yml
# dest: "{{ ansible_user_dir }}/.config/lazygit/config.yml"
# mode: "0644"
# force: true