Skip to main content

Little Timmy will try their best to find those unused Ansible variables.

Project description

little-timmy

Little Timmy will try their best to find those unused Ansible variables.

cd repo/ansible/plays
ansible-galaxy collection install -f -r requirements.yml -p .
ansible-galaxy role install -f -r requirements.yml -p galaxy_roles

pip3 install little-timmy

little-timmy
# or 
python3 -m little_timmy

Little Timmy can find the "80%" of unused variables but due to the numerous ways variables can be declared and consumed in Ansible, some will be missed.

Github Action

Workflow

name: little-timmy
on:
  push:
jobs:
  little-timmy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Run action
        uses: hoo29/little-timmy@v1-action

Variables

inputs:
  directory:
    description: The root directory for your ansible
    required: false
    default: "."
  additional_cli_args:
    description: Additional CLI arguments to pass to little-timmy
    required: false
    default: ""
  galaxy_role_requirements_file:
    description: Location, relative to `directory`, of the ansible galaxy roles requirements file.
    required: false
  galaxy_collection_requirements_file:
    description: Location, relative to `directory`, of the ansible galaxy collections requirements file.
    required: false
  ansible_vault_password:
    description: |
      Optional ansible-vault password. The content will be a written to a 
      file and ANSIBLE_VAULT_PASSWORD_FILE set to its location. Only used
      by ansible if a vaulted value is found.
    required: false
    default: replace-me-if-vault-is-used

Version and Tags

The latest version can be found in pyproject.toml and the changelog is CHANGELOG.md.

The tags on this repo are used for the Github action and do not relate the published python module.

Config

Additional, optional configuration can be specified in a YAML configuration file named .little-timmy. The file can be located at any level between the current working directory and /.

skip_vars:
  - vars
  - to
  - ignore
skip_dirs:
  - venv
  - tests
  - molecule

Help

little-timmy -h

usage: little-timmy [-h] [-c CONFIG_FILE] [-d | --dave-mode | --no-dave-mode] [-e | --exit-success | --no-exit-success] [-g | --github-action | --no-github-action] [-j | --json-output | --no-json-output] [-l LOG_LEVEL] [directory]

Process a directory path

positional arguments:
  directory             The directory to process

options:
  -h, --help            show this help message and exit
  -c CONFIG_FILE, --config-file CONFIG_FILE
                        Config file to use. By default it will search all dirs to `/` for .little-timmy
  -d, --dave-mode, --no-dave-mode
                        Make logging work on dave's macbook
  -e, --exit-success, --no-exit-success
                        Exit 0 when unused vars are found.
  -g, --github-action, --no-github-action
                        Output results for github actions.
  -j, --json-output, --no-json-output
                        Output results as json to stdout. Disables the stderr logger.
  -l LOG_LEVEL, --log-level LOG_LEVEL
                        set the logging level (default: INFO)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

little_timmy-1.1.1.tar.gz (8.3 kB view hashes)

Uploaded Source

Built Distribution

little_timmy-1.1.1-py3-none-any.whl (8.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page