Skip to content

Latest commit

 

History

History
191 lines (146 loc) · 4.49 KB

File metadata and controls

191 lines (146 loc) · 4.49 KB

Configs Role

Application configuration deployment for Starship, Helix, Yazi and other tools.

Description

The Configs role deploys configuration files (dotfiles) for the various CLI tools installed by the cli_tools role. It provides a consistent, customized user experience with optimized settings for development workflows.

Requirements

  • Ubuntu 20.04 LTS or later
  • Ansible 2.12 or later
  • Common role (automatically included as dependency)
  • CLI Tools role (automatically included as dependency)

Role Variables

Available Variables

The following variables can be set in defaults/main.yml:

# Configuration templates to deploy
config_templates:
  - src: starship.toml.j2
    dest: "{{ ansible_user_dir }}/.config/starship.toml"
    mode: '0644'
  - src: helix.toml.j2
    dest: "{{ ansible_user_dir }}/.config/helix/config.toml"
    mode: '0644'
  - src: yazi.toml.j2
    dest: "{{ ansible_user_dir }}/.config/yazi/yazi.toml"
    mode: '0644'
  - src: yazi_keymap.toml.j2
    dest: "{{ ansible_user_dir }}/.config/yazi/keymap.toml"
    mode: '0644'

# User configuration
target_user: "{{ ansible_user }}"

# Starship configuration
starship_config:
  format: "$all$character"
  add_newline: true
  
# Helix configuration
helix_config:
  theme: "default"
  editor:
    line_number: "relative"
    mouse: false
    
# Yazi configuration
yazi_config:
  manager:
    show_hidden: false
    sort_by: "natural"

Variable Descriptions

  • config_templates: List of configuration templates to deploy
  • target_user: User for which configurations are being deployed
  • starship_config: Starship prompt configuration options
  • helix_config: Helix editor configuration options
  • yazi_config: Yazi file manager configuration options

Dependencies

  • common: Base system setup and essential packages
  • cli_tools: CLI tools that need to be configured

Example Playbook

---
- hosts: servers
  become: yes
  roles:
    - common
    - rust
    - cli_tools
    - configs

Configuration Files

Starship Prompt (starship.toml)

Configures the Starship cross-shell prompt with:

  • Git status and branch information
  • Language version indicators (Python, Node.js, Rust, etc.)
  • Directory navigation shortcuts
  • Custom prompt symbols and colors
  • Performance optimizations

Helix Editor (config.toml)

Configures the Helix text editor with:

  • Relative line numbers
  • Modern key bindings
  • LSP integration settings
  • Search and navigation options
  • Theme and appearance settings

Yazi File Manager (yazi.toml and keymap.toml)

Configures the Yazi terminal file manager with:

  • File sorting and display options
  • Custom key bindings
  • Preview settings
  • Navigation shortcuts
  • Integration with other tools

Features

  • Template System: Uses Jinja2 templates for flexible configuration
  • User-specific: Deploys configurations in user's home directory
  • Modular: Each tool has separate configuration files
  • Customizable: Easy to override default configurations
  • Consistent: Provides unified appearance and behavior across tools

Customization

You can customize configurations by overriding template variables:

# Custom Starship configuration
starship_config:
  format: "$username$hostname$directory$git_branch$character"
  add_newline: false
  character:
    success_symbol: "[➜](bold green)"
    error_symbol: "[➜](bold red)"

# Custom Helix configuration
helix_config:
  theme: "dark_plus"
  editor:
    line_number: "absolute"
    mouse: true
    cursor_shape:
      insert: "bar"
      normal: "block"

Template Modification

To modify configurations further, edit the template files:

  • templates/starship.toml.j2: Starship prompt configuration
  • templates/helix.toml.j2: Helix editor settings
  • templates/yazi.toml.j2: Yazi file manager configuration
  • templates/yazi_keymap.toml.j2: Yazi key bindings

Directory Structure

Configurations are deployed to standard XDG config directories:

~/.config/
├── starship.toml
├── helix/
│   └── config.toml
└── yazi/
    ├── yazi.toml
    └── keymap.toml

Integration

These configurations integrate with:

  • Fish shell (via fish role configuration)
  • Modern CLI tools (bat, eza, fd, etc.)
  • Development workflows
  • Terminal multiplexers

Validation

The role ensures:

  • Configuration directories are created
  • Templates are properly rendered
  • File permissions are correct
  • Configurations are valid

License

MIT

Author Information

Development Team - Internal Use