A comprehensive Ansible playbook for automating the setup of a modern development environment on Ubuntu servers. This project provides infrastructure as code for consistent, repeatable server provisioning with a focus on developer productivity and modern tooling.
This playbook transforms a fresh Ubuntu installation into a fully configured development environment. It installs and configures essential tools, modern CLI utilities, development environments, and productivity enhancers through a modular role-based architecture.
- Infrastructure as Code: Complete server configuration defined in version-controlled YAML
- Idempotent Execution: Safe to run multiple times without side effects
- Modular Design: Independent roles that can be executed selectively
- Comprehensive Tooling: Modern alternatives to traditional Unix tools
- Security First: GPG verification, encrypted secrets, and secure defaults
- Cross-machine Sync: Shell history and configurations that follow you
# Install required Ansible collections and roles
ansible-galaxy install -r requirements.yml
# Verify Ansible version (2.12+ required)
ansible --versionEdit inventory/hosts.ini to specify your target hosts:
[development]
dev-server ansible_host=192.168.1.100 ansible_user=ubuntu
[production]
prod-server ansible_host=10.0.1.100 ansible_user=adminCustomize installation in group_vars/all/:
main.yml: General configuration and repository settingsversions.yml: Software versions and release informationvault.yml: Encrypted secrets (Tailscale auth key, Atuin credentials)
Create encrypted vault file:
ansible-vault create group_vars/all/vault.yml# Complete installation
ansible-playbook -i inventory/hosts.ini site.yml --ask-vault-pass
# Test with dry run
ansible-playbook -i inventory/hosts.ini site.yml --check --ask-vault-pass
# Install specific components only
ansible-playbook -i inventory/hosts.ini site.yml --tags "docker,cli" --ask-vault-pass
# Skip certain roles
ansible-playbook -i inventory/hosts.ini site.yml --skip-tags "tailscale" --ask-vault-pass- Base System: Updated packages, build tools, essential dependencies
- User Configuration: Proper permissions, lingering services
- Fish Shell: Smart shell with syntax highlighting and autocompletion
- Starship Prompt: Fast, customizable prompt with Git integration
- Modern CLI Tools: bat, eza, fd, ripgrep, zoxide, bottom, dust
- Rust Toolchain: Complete Rust development environment via rustup
- Helix Editor: Modern modal editor with LSP support
- Docker: Container development platform with user group access
- fzf: Fuzzy finder for files and commands
- lazydocker: Terminal UI for Docker management
- yazi: Terminal file manager with preview support
- Atuin: Encrypted shell history sync across machines
- Tailscale: Zero-config VPN for secure networking
- GPG Verification: All external packages verified with GPG signatures
| Role | Purpose | Dependencies |
|---|---|---|
common |
Base system setup and essential packages | None |
fish |
Fish shell installation and configuration | common |
rust |
Rust toolchain via rustup | common |
docker |
Docker CE with user management | common |
tailscale |
VPN client configuration | common |
cli_tools |
Modern CLI utilities | common, rust |
configs |
Application configuration deployment | common, cli_tools |
atuin |
Shell history synchronization | common, fish, cli_tools |
The roles execute in dependency order:
common → fish → rust → docker → tailscale → cli_tools → configs → atuin
Execute specific components using tags:
# Install only base system and shell
ansible-playbook site.yml --tags "base,shell"
# Install development tools only
ansible-playbook site.yml --tags "development"
# Install networking components
ansible-playbook site.yml --tags "networking"- Functional Tags:
base,shell,development,networking - Role Tags:
common,fish,rust,docker,tailscale,cli,configs,atuin - Component Tags:
prerequisites,terminal,toolchain,containers,vpn,utilities
Override default behavior through group or host variables:
# group_vars/development/main.yml
rust_toolchain: "nightly"
docker_compose_version: "2.24.0"
# host_vars/dev-server/main.yml
skip_fish_default: true
tailscale_auth_key: "{{ vault_dev_tailscale_key }}"Target specific hosts or groups:
# Single host
ansible-playbook site.yml --limit "dev-server"
# Host group
ansible-playbook site.yml --limit "development"
# Multiple hosts
ansible-playbook site.yml --limit "dev-server,staging-server"- OS: Ubuntu 20.04 LTS, 22.04 LTS, or 24.04 LTS
- Memory: 2GB RAM minimum, 4GB recommended
- Storage: 10GB free space minimum
- Network: Internet connectivity for package downloads
- Ansible: Version 2.12 or later
- Python: 3.8 or later
- SSH: Key-based authentication to target hosts
- Privileges: sudo access on target hosts
- Package repositories (Ubuntu, Docker, Tailscale, GitHub)
- Rust toolchain downloads (rustup.rs)
- Ansible Galaxy collections
Permission Denied Errors
# Ensure SSH key authentication
ssh-add ~/.ssh/id_rsa
ssh ubuntu@your-server # Test connectionVault Decryption Errors
# Test vault file
ansible-vault view group_vars/all/vault.ymlCollection Missing Errors
# Reinstall collections and roles
ansible-galaxy install -r requirements.yml --forceDocker Permission Issues
# User needs to logout/login after docker group addition
# Or run: newgrp docker# Syntax check
ansible-playbook site.yml --syntax-check
# Dry run
ansible-playbook site.yml --check
# Test connectivity
ansible all -m ping -i inventory/hosts.iniRefer to the Repository Guidelines for contributor expectations, role workflows, and PR requirements.
- Clone the repository
- Install development dependencies
- Run syntax checks before committing
- Test against staging hosts
- Update documentation for changes
# Syntax validation
ansible-playbook site.yml --syntax-check
# Dry run testing
ansible-playbook site.yml --check --diff
# Lint roles
ansible-lint roles/*/- Add version to
group_vars/all/versions.yml - Update relevant role's tasks and defaults
- Add configuration templates if needed
- Update role documentation
- Test on staging environment
- All external repositories use GPG verification
- Sensitive data encrypted with Ansible Vault
- User-level installations preferred over system-wide
- Minimal privilege escalation
- Secure defaults for all services
MIT License - see LICENSE file for details
Development Team - Internal Use
This playbook provides a foundation for consistent development environments. Customize it to match your organization's specific needs and security requirements.