Skip to content

Latest commit

 

History

History
194 lines (148 loc) · 4.9 KB

File metadata and controls

194 lines (148 loc) · 4.9 KB

CLI Tools Role

Modern command-line utilities installation including bat, eza, fd, helix, and GitHub releases.

Description

The CLI Tools role installs a comprehensive collection of modern command-line utilities that enhance productivity and provide better alternatives to traditional Unix tools. It handles installations via cargo (Rust packages), system packages, and GitHub releases.

Requirements

  • Ubuntu 20.04 LTS or later
  • Ansible 2.12 or later
  • Common role (automatically included as dependency)
  • Rust role (automatically included as dependency for cargo installations)
  • Internet connectivity for package downloads

Role Variables

Available Variables

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

# Cargo packages to install
cargo_packages:
  - bat          # Cat with syntax highlighting
  - eza          # Modern ls replacement
  - fd-find      # Modern find replacement
  - ripgrep      # Fast grep replacement
  - starship     # Cross-shell prompt
  - zoxide       # Smart cd replacement
  - bottom       # System monitor
  - dust         # Disk usage analyzer

# System packages to install
system_packages:
  - helix        # Modern text editor
  - fzf          # Fuzzy finder

# GitHub release downloads
github_releases:
  - name: lazydocker
    repo: jesseduffield/lazydocker
    version: "{{ lazydocker_version }}"
    asset_pattern: "Linux_x86_64.tar.gz"
    binary_name: lazydocker
    install_path: "/usr/local/bin"

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

Variable Descriptions

  • cargo_packages: List of Rust packages to install via cargo
  • system_packages: List of packages to install via system package manager
  • github_releases: Configuration for tools installed from GitHub releases
  • target_user: User for which tools are being configured

Dependencies

  • common: Base system setup and essential packages
  • rust: Rust toolchain for cargo package installations

Example Playbook

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

Installed Tools

Cargo-installed Tools

  • bat: A cat clone with syntax highlighting and Git integration
  • eza: A modern replacement for ls with colors and Git integration
  • fd-find: A simple, fast alternative to find
  • ripgrep: A line-oriented search tool that recursively searches directories
  • starship: A minimal, fast, and customizable prompt for any shell
  • zoxide: A smarter cd command that learns your habits
  • bottom: A graphical process/system monitor
  • dust: A more intuitive version of du written in Rust

System Packages

  • helix: A post-modern modal text editor
  • fzf: A general-purpose command-line fuzzy finder

GitHub Releases

  • lazydocker: A simple terminal UI for Docker and Docker Compose

Features

  • Multiple Installation Methods: Supports cargo, apt, and GitHub releases
  • Version Management: Centralized version control via group variables
  • Security: Checksum validation for downloaded binaries
  • User Integration: Configures tools for specified user
  • Shell Integration: Prepares tools for Fish shell integration

Tool Descriptions

bat

Enhanced cat with syntax highlighting, Git integration, and automatic paging.

bat file.py  # Syntax highlighted output

eza

Modern ls replacement with colors, icons, and Git status integration.

eza -la      # Long format with all files
eza --tree   # Tree view

fd

Fast and user-friendly alternative to find.

fd pattern   # Find files matching pattern
fd -e py     # Find Python files

ripgrep

Fast grep alternative optimized for searching code.

rg "pattern" # Search for pattern in current directory
rg -t py     # Search only Python files

starship

Cross-shell prompt with intelligent context awareness.

# Automatically shows Git status, language versions, etc.

zoxide

Smart cd that learns from your usage patterns.

z project    # Jump to frequently used project directory

helix

Modal text editor inspired by Kakoune with built-in LSP support.

hx file.py   # Edit Python file with LSP integration

fzf

Fuzzy finder for files, command history, and more.

fzf          # Interactive file finder
history | fzf # Search command history

Configuration

Tools are configured through the configs role, which deploys:

  • Starship prompt configuration
  • Helix editor settings
  • Shell integrations for Fish

Customization

You can customize the installation by overriding variables:

# Add additional cargo packages
cargo_packages:
  - bat
  - eza
  - tokei        # Code statistics tool
  - hyperfine    # Benchmarking tool

# Modify GitHub releases
github_releases:
  - name: your-tool
    repo: owner/repo
    version: "v1.0.0"
    asset_pattern: "linux-x86_64.tar.gz"

License

MIT

Author Information

Development Team - Internal Use