Skip to content

CLI tool that pretty-prints an output of `ansible-playbook --list-tasks` command

License

Notifications You must be signed in to change notification settings

keewek/ansible-pretty-print

Repository files navigation

ansible-pretty-print

Go Reference Go Report Card

CLI tool that pretty-prints an output of ansible-playbook --list-tasks command.

Install

go install github.com/keewek/ansible-pretty-print@latest

or download app executable at Releases page

Usage

Usage: ansible-pretty-print [OPTION]... [FILE]
Pretty-print Ansible's --list-tasks output

  -chop
        chop long lines
  -dos
        DOS box-drawing characters
  -indent
        indent block/role
  -mono
        calculate string width as monospace width
  -stats
        print stats
  -stdin
        read standard input
  -table
        table output
  -version
        output version information
  -width int
        custom line width
  • File

    ansible-pretty-print path/to/ansible--list-tasks-output

  • Stdin

    ansible-playbook --list-tasks path/to/playbook -i path/to/inventory | ansible-pretty-print --stdin

  • BASH function

    lt-ansible-playbook() {
        ansible-playbook --list-tasks "$@" | ansible-pretty-print --stdin --chop
    }
    
    ltt-ansible-playbook() {
        ansible-playbook --list-tasks "$@" | ansible-pretty-print --stdin --dos --table
    }

    Columns output:

    lt-ansible-playbook path/to/playbook -i path/to/inventory

    Table output:

    ltt-ansible-playbook path/to/playbook -i path/to/inventory

Features

  • Default output

  • Flag --indent: indent block/role

  • Flag --chop: chop long lines

    Use --width flag to specify custom width

  • Flag --table: table output

    Use --width flag to specify custom width

  • Flag --dos: DOS box-drawing characters

  • Flag --mono: calculate string width as monospace width

    Use with East-Asian content