Fuzzy-search CLI wrappers for ansible-playbook and ansible ad-hoc
Project description
ansifuzz
Fuzzy-search CLI wrappers for ansible-playbook (ap) and ansible ad-hoc (aa).
Every flag opens an fzf picker. Passing a value pre-fills the search query — you still confirm with Enter. This means ap -i dev -l web -p nginx -t config -r opens four sequential pickers, each already filtered, so a few keystrokes get you to a reviewed playbook run.
Requirements
- Python 3.9+
- fzf on your PATH
pyyaml(installed automatically)
# Debian/Ubuntu
sudo apt install fzf
# macOS
brew install fzf
# Fedora/RHEL
sudo dnf install fzf
Installation
From PyPI (recommended)
pip install ansifuzz
From source
git clone https://github.com/chrisvanmeer/ansifuzz
cd ansifuzz
bash install.sh
Make sure ~/.local/bin is on your PATH (not needed inside a virtualenv):
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
Configuration
~/.config/ansifuzz/config.yaml is created automatically on first install.
# Default inventory used by both ap and aa.
# Relative paths are resolved from the current working directory.
# When set, the inventory picker is skipped — unless you pass -i explicitly.
default_inventory: production.ini
# Directory to search for playbooks (default: playbooks/)
# playbook_dir: playbooks
Inventory files can be either INI or YAML format — both are detected and parsed automatically.
ap — ansible-playbook
ap [-i [query]] [-l [query]] [-p [query]] [-t [query]] [-r]
| Flag | Description |
|---|---|
-i |
Inventory picker, optionally pre-filled. Overrides default_inventory. |
-l |
Limit picker over hosts/groups from the inventory, optionally pre-filled. |
-p |
Playbook picker over playbooks/*.yml, optionally pre-filled. |
-t |
Tags picker — tags are parsed from the chosen playbook, optionally pre-filled. |
-r |
Review mode: adds --check --diff to the ansible-playbook call. |
Examples
# Fully interactive — all pickers in sequence
ap
# Inventory from config, pick playbook interactively
ap
# Pre-fill playbook picker with "nginx"
ap -p nginx
# Pre-fill limit picker with "0007" → finds server0007.example.com
ap -l 0007
# All four pickers pre-filled
ap -i dev -l web -p nginx -t config
# Review run with pre-filled pickers
ap -i dev -l 0007 -p infra -r
# Explicit values only, no pickers
ap -i production.ini -l webservers -p playbooks/deploy.yml
fzf keybindings
| Key | Action |
|---|---|
Enter |
Confirm selection |
Esc |
Cancel / skip optional step |
Tab |
Multi-select (limit and tags pickers) |
Multi-selected limits are joined with : (web01:web02).
Multi-selected tags are joined with , (deploy,config).
aa — ansible ad-hoc
aa [-i [query]] [-l [query]] [-m module] [-a 'args'] [-r]
| Flag | Description |
|---|---|
-i |
Inventory picker, optionally pre-filled. Overrides default_inventory. |
-l |
Target picker over hosts/groups, optionally pre-filled. Defaults to all. |
-m |
Module name — skips picker when given directly. |
-a |
Module arguments (free-form string). |
-r |
Review mode: adds --check to the ansible call. |
Examples
# Ping all hosts in default inventory
aa -m ansible.builtin.ping
# Uptime of a pre-filtered group
aa -l web -m ansible.builtin.command -a "cmd=uptime"
# Pick everything interactively
aa
# Restart a service — review first
aa -l db01 -m ansible.builtin.service -a "name=postgresql state=restarted" -r
# Switch to staging inventory, pick target interactively
aa -i staging
Flag behaviour at a glance
| Invocation | Behaviour |
|---|---|
-i omitted |
Use default_inventory from config, or picker if not set |
-i (no value) |
Picker opens, no pre-fill |
-i dev |
Picker opens, pre-filled with dev |
-l omitted |
No limit applied |
-l (no value) |
Picker opens, no pre-fill |
-l 0007 |
Picker opens, pre-filled — fzf finds server0007.example.com |
-p, -t |
Same pattern as -l |
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ansifuzz-1.1.1.tar.gz.
File metadata
- Download URL: ansifuzz-1.1.1.tar.gz
- Upload date:
- Size: 12.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
083f395aa07d00bfcf1a86c7b0392c3c01db7ee86d4deff0fa1996b42a888681
|
|
| MD5 |
698255c48afb4f4469f82f66de79a097
|
|
| BLAKE2b-256 |
83708cff35cf194d98dec6acdd612f28d69e2d12d993904e8cf3fe1520f72da5
|
Provenance
The following attestation bundles were made for ansifuzz-1.1.1.tar.gz:
Publisher:
publish.yml on chrisvanmeer/ansifuzz
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ansifuzz-1.1.1.tar.gz -
Subject digest:
083f395aa07d00bfcf1a86c7b0392c3c01db7ee86d4deff0fa1996b42a888681 - Sigstore transparency entry: 1315982641
- Sigstore integration time:
-
Permalink:
chrisvanmeer/ansifuzz@0459da5a0f513601c4a5604d0bdd8cf8b5176d47 -
Branch / Tag:
refs/tags/v1.1.1 - Owner: https://github.com/chrisvanmeer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0459da5a0f513601c4a5604d0bdd8cf8b5176d47 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ansifuzz-1.1.1-py3-none-any.whl.
File metadata
- Download URL: ansifuzz-1.1.1-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e34e05ac5353b6527219e4b2a3863ca74523f231612c38ac9c839c74d6f8330
|
|
| MD5 |
5024e1fd48558b94b482dd163b5ee3cf
|
|
| BLAKE2b-256 |
831b87b4eb2b6d4693112417f2a52e57a4a7773cff829933b1bf8999e80881c6
|
Provenance
The following attestation bundles were made for ansifuzz-1.1.1-py3-none-any.whl:
Publisher:
publish.yml on chrisvanmeer/ansifuzz
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ansifuzz-1.1.1-py3-none-any.whl -
Subject digest:
2e34e05ac5353b6527219e4b2a3863ca74523f231612c38ac9c839c74d6f8330 - Sigstore transparency entry: 1315982760
- Sigstore integration time:
-
Permalink:
chrisvanmeer/ansifuzz@0459da5a0f513601c4a5604d0bdd8cf8b5176d47 -
Branch / Tag:
refs/tags/v1.1.1 - Owner: https://github.com/chrisvanmeer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0459da5a0f513601c4a5604d0bdd8cf8b5176d47 -
Trigger Event:
push
-
Statement type: