Architecture Overview
The system is built on three complementary layers:Chezmoi
File management and templating layer
Ansible
System configuration and package management
Bitwarden + age
Secrets management and encryption
Layer 1: Chezmoi (File Management)
Role: Manages dotfiles, handles templating, and orchestrates the other layers.Responsibilities
- Source State Management: Maintains the desired state of all configuration files in
~/.local/share/chezmoi/ - File Templating: Generates personalized configs using Go templates
- Encryption Integration: Seamlessly encrypts/decrypts sensitive files using
age - Secrets Integration: Pulls secrets from Bitwarden CLI during file generation
- Orchestration: Triggers Ansible playbooks via
run_once_scripts
Key Features
Chezmoi acts as the entry point for the entire system. Running
chezmoi init --apply bootstraps everything.Layer 2: Ansible (System Configuration)
Role: Automates system-level configuration that requires root privileges.Responsibilities
- Package Installation: Installs APT and Snap packages from centralized lists
- Repository Management: Adds external repositories with GPG key handling
- System Hardening: Configures passwordless sudo
- Desktop Environment: Sets GNOME preferences (dark mode, clock, power management)
Data-Driven Approach
Instead of creating separate roles for each application, this system uses a universalcommon role that reads from centralized data files:
Integration with Chezmoi
Ansible is invoked automatically by chezmoi via arun_once_ script:
run_once_after_ansible.sh.tmpl
Layer 3: Secrets Management
Role: Secures sensitive data both in transit and at rest.Two-Pronged Security Model
Bitwarden CLI
Runtime Secrets: Pulls credentials on-demand during
chezmoi apply- SSH private keys from Secure Notes
- AWS credentials from Custom Fields
- Age encryption key retrieval/backup
Secret Flow
Component Interaction Flow
Initial Bootstrap
Steady-State Apply
Design Principles
Idempotency
Idempotency
Every operation can be run multiple times safely:
- Ansible tasks use declarative state management
- Chezmoi only applies changes when files differ
run_once_scripts include guard clauses
Portability
Portability
Works across different environments:
- Standard Linux distributions (Ubuntu, Debian)
- Windows Subsystem for Linux (WSL)
- Hybrid work/personal machine configurations
Scalability
Scalability
Easy to extend:
- Data-driven Ansible approach avoids role proliferation
- Centralized package lists in
group_vars/all.yml - Template-based configuration generation
Security
Security
Defense in depth:
- Secrets never committed to Git
- Age encryption for sensitive config files
- Bitwarden for credential storage
- Passwordless sudo configuration
File Organization
Files prefixed with
private_ are automatically encrypted by chezmoi. The dot_ prefix becomes . in the home directory.Next Steps
Chezmoi Deep Dive
Learn about configuration and templating
Ansible Automation
Understand the data-driven approach
Secrets Management
Explore Bitwarden and age integration
Quick Start
Get your environment set up