Reference

Commands of a script

Every script is its own CLI: python site.py COMMAND, or imix site.py COMMAND for a script that imports nothing.

CommandWhat it does
showlist the files the script declares (the default)
cat [PATH...]print their contents
generate [DEST]write the playbook directory (default out), or a tar archive
diff [DEST]show what generate DEST would change
run [PLAYBOOK]build into a temp dir and run ansible-playbook
container [PLAYBOOK]the same, with ansible in a container
install [DEST]generate, then ansible-galaxy install into the tree
lintrun the registered checks, then ansible-lint
test [TARGET]run molecule, ansible-test, or a role’s test playbook
profileslist the profiles the script mentions
describelist the stages, tags, groups and variables, and what each is for
doctorcheck this machine against the runtime requirements
envbuild (or reuse) an environment that meets them, with uv
imageprint the container image the script asks for

Every command also takes --jsonl, before or after its name: see Events. An option with a second, --no- form can be a default in the settings, and that form undoes it for one run.

cat#

python site.py cat [PATHS...] [OPTIONS]

Print the contents of PATHS (default: every file).

OptionTakesWhat it does
PATHSarray of stringAn argument, by its place.
--bare
--no-bare
booleanDo not add a default inventory and ansible.cfg.
--profilearray of stringActivate a profile (repeatable, comma-separated; ‘*’ for all). Read before the script runs, so it also steers what it declares.

container#

python site.py container [PLAYBOOK] [OPTIONS]

Run PLAYBOOK (default: site.yml) with ansible-playbook in a container.

The tree is built here and mounted into the image, which only has to have ansible: an execution environment will do. The image is –image, else the script’s container_image(), else its base’s.

OptionTakesWhat it does
PLAYBOOKstringAn argument, by its place.
--bare
--no-bare
booleanDo not add a default inventory and ansible.cfg.
--become
--no-become
booleanRun operations with become.
--check
--no-check
booleanansible-playbook –check.
--connectionstringConnection type.
--diff
--no-diff
booleanansible-playbook –diff.
--dirstringBuild in this directory instead of a temporary one.
--enginepodman | dockerWhat runs the container (default: podman, else docker).
--extra-varsarray of stringExtra variables (repeatable).
--imagestringThe image to run ansible in (default: the script’s; see image).
--install
--no-install
booleanInstall galaxy requirements into the tree first.
--inventorystringOverride the inventory.
--keep
--no-keep
booleanKeep the temporary build directory.
--limitstringLimit to a host subset.
--list-hostsbooleanList matching hosts and exit.
--list-tasksbooleanList the tasks and exit.
--outside-paths
--no-outside-paths
booleanLet the environment’s (–env) or the image’s (container) collections and roles count: the tree’s ansible.cfg names them after its own, and –install does not install them again. Off, only the tree’s count.
--profilearray of stringActivate a profile (repeatable, comma-separated; ‘*’ for all). Read before the script runs, so it also steers what it declares.
--pullmissing | always | never | newer
default "missing"
When to pull the image.
--recordstringAlso write the run’s events to FILE (JSONL), for imix replay; ansible’s output stays as it is.
--skip-tagsstringSkip these tags.
--start-at-taskstringStart at this task.
--stepbooleanConfirm each task.
--syntax-checkbooleanOnly check the syntax.
--tagsstringOnly run these tags.
--userstringConnect as this user.
--vault-password-filestringVault password file.
--verboseinteger, repeatablePass -v to ansible (repeatable).

describe#

python site.py describe [OPTIONS]

Say what this script has, and what each is for: its stages, tags, groups and variables.

OptionTakesWhat it does
--jsonbooleanWrite it as one JSON object, on one line.
--profilearray of stringActivate a profile (repeatable, comma-separated; ‘*’ for all). Read before the script runs, so it also steers what it declares.

diff#

python site.py diff [DEST] [OPTIONS]

Show what generate DEST would change on disk.

OptionTakesWhat it does
DESTstringAn argument, by its place.
--bare
--no-bare
booleanDo not add a default inventory and ansible.cfg.
--profilearray of stringActivate a profile (repeatable, comma-separated; ‘*’ for all). Read before the script runs, so it also steers what it declares.

doctor#

python site.py doctor [OPTIONS]

Check this machine against the script’s runtime requirements.

OptionTakesWhat it does
--env
--no-env
booleanRun ansible from an environment built (or reused) with uv from the script’s requirements; see env.
--profilearray of stringActivate a profile (repeatable, comma-separated; ‘*’ for all). Read before the script runs, so it also steers what it declares.

env#

python site.py env [OPTIONS]

Build the environment the script’s requirements describe, with uv.

It holds ansible-core and the pip requirements, on the Python that requires_python() asks for, installed from a hash-checked lock, and the collections and roles requires_collection() and requires_role() ask for, installed with its own ansible-galaxy. Prints its directory; run --env (and install, lint, test, doctor) use it, and so does imix lsp.

OptionTakesWhat it does
--dirstringBuild here instead of the cache (~/.cache/instamix/envs).
--profilearray of stringActivate a profile (repeatable, comma-separated; ‘*’ for all). Read before the script runs, so it also steers what it declares.
--upgrade
--no-upgrade
booleanResolve the requirements again instead of reusing the lock.

generate#

python site.py generate [DEST] [OPTIONS]

Write the playbook directory to DEST (default: out).

A DEST ending in .tar, .tar.gz/.tgz, .tar.bz2/.tbz2 or .tar.xz/.txz is written as a tar archive instead, and - writes one to stdout.

OptionTakesWhat it does
DESTstringAn argument, by its place.
--bare
--no-bare
booleanDo not add a default inventory and ansible.cfg.
--compressbz2 | gz | none | xzWrite a tar archive with this compression, whatever DEST is called (default: from the name; gz for -).
--env
--no-env
booleanRun ansible from an environment built (or reused) with uv from the script’s requirements; see env.
--force
--no-force
booleanWrite into a non-empty directory instamix did not create.
--outside-paths
--no-outside-paths
booleanLet the environment’s (–env) or the image’s (container) collections and roles count: the tree’s ansible.cfg names them after its own, and –install does not install them again. Off, only the tree’s count.
--profilearray of stringActivate a profile (repeatable, comma-separated; ‘*’ for all). Read before the script runs, so it also steers what it declares.

image#

python site.py image [OPTIONS]

Print the container image the script asks for (exit 1 when none): its container_image(), else its base’s.

OptionTakesWhat it does
--profilearray of stringActivate a profile (repeatable, comma-separated; ‘*’ for all). Read before the script runs, so it also steers what it declares.

install#

python site.py install [DEST] [OPTIONS]

Generate into DEST and install galaxy roles and collections there.

OptionTakesWhat it does
DESTstringAn argument, by its place.
--bare
--no-bare
booleanDo not add a default inventory and ansible.cfg.
--env
--no-env
booleanRun ansible from an environment built (or reused) with uv from the script’s requirements; see env.
--outside-paths
--no-outside-paths
booleanLet the environment’s (–env) or the image’s (container) collections and roles count: the tree’s ansible.cfg names them after its own, and –install does not install them again. Off, only the tree’s count.
--profilearray of stringActivate a profile (repeatable, comma-separated; ‘*’ for all). Read before the script runs, so it also steers what it declares.
--skip-requirements
--no-skip-requirements
booleanRun even if this machine lacks the script’s runtime requirements.

lint#

python site.py lint [OPTIONS]

Run the registered checks, then ansible-lint (or a syntax check).

OptionTakesWhat it does
--bare
--no-bare
booleanDo not add a default inventory and ansible.cfg.
--checks-onlybooleanOnly run the registered checks.
--env
--no-env
booleanRun ansible from an environment built (or reused) with uv from the script’s requirements; see env.
--no-builtin-checks
--builtin-checks
booleanSkip instamix’s own structural checks.
--no-checks
--checks
booleanSkip the registered checks.
--outside-paths
--no-outside-paths
booleanLet the environment’s (–env) or the image’s (container) collections and roles count: the tree’s ansible.cfg names them after its own, and –install does not install them again. Off, only the tree’s count.
--profilearray of stringActivate a profile (repeatable, comma-separated; ‘*’ for all). Read before the script runs, so it also steers what it declares.
--skip-requirements
--no-skip-requirements
booleanRun even if this machine lacks the script’s runtime requirements.

profiles#

python site.py profiles [OPTIONS]

List the profiles this script mentions.

OptionTakesWhat it does
--profilearray of stringActivate a profile (repeatable, comma-separated; ‘*’ for all). Read before the script runs, so it also steers what it declares.

run#

python site.py run [PLAYBOOK] [OPTIONS] [-- ARGS]

Run PLAYBOOK (default: site.yml) with ansible-playbook.

OptionTakesWhat it does
PLAYBOOKstringAn argument, by its place.
--bare
--no-bare
booleanDo not add a default inventory and ansible.cfg.
--become
--no-become
booleanRun operations with become.
--check
--no-check
booleanansible-playbook –check.
--connectionstringConnection type.
--diff
--no-diff
booleanansible-playbook –diff.
--dirstringBuild in this directory instead of a temporary one.
--env
--no-env
booleanRun ansible from an environment built (or reused) with uv from the script’s requirements; see env.
--extra-varsarray of stringExtra variables (repeatable).
--install
--no-install
booleanInstall galaxy requirements into the tree first.
--inventorystringOverride the inventory.
--keep
--no-keep
booleanKeep the temporary build directory.
--limitstringLimit to a host subset.
--list-hostsbooleanList matching hosts and exit.
--list-tasksbooleanList the tasks and exit.
--outside-paths
--no-outside-paths
booleanLet the environment’s (–env) or the image’s (container) collections and roles count: the tree’s ansible.cfg names them after its own, and –install does not install them again. Off, only the tree’s count.
--profilearray of stringActivate a profile (repeatable, comma-separated; ‘*’ for all). Read before the script runs, so it also steers what it declares.
--recordstringAlso write the run’s events to FILE (JSONL), for imix replay; ansible’s output stays as it is.
--skip-requirements
--no-skip-requirements
booleanRun even if this machine lacks the script’s runtime requirements.
--skip-tagsstringSkip these tags.
--start-at-taskstringStart at this task.
--stepbooleanConfirm each task.
--syntax-checkbooleanOnly check the syntax.
--tagsstringOnly run these tags.
--userstringConnect as this user.
--vault-password-filestringVault password file.
--verboseinteger, repeatablePass -v to ansible (repeatable).

show#

python site.py show [OPTIONS]

List the files this script declares (default).

OptionTakesWhat it does
--bare
--no-bare
booleanDo not add a default inventory and ansible.cfg.
--profilearray of stringActivate a profile (repeatable, comma-separated; ‘*’ for all). Read before the script runs, so it also steers what it declares.

test#

python site.py test [TARGET] [OPTIONS]

Run the declared tests: molecule, ansible-test, or a role test playbook.

OptionTakesWhat it does
TARGETstringAn argument, by its place.
--bare
--no-bare
booleanDo not add a default inventory and ansible.cfg.
--dirstringBuild in this directory instead of a temporary one.
--env
--no-env
booleanRun ansible from an environment built (or reused) with uv from the script’s requirements; see env.
--install
--no-install
booleanInstall galaxy requirements into the tree first.
--keep
--no-keep
booleanKeep the build directory.
--kindsanity | units | integration
default "sanity"
What ansible-test should run.
--listbooleanList what could be tested and exit.
--outside-paths
--no-outside-paths
booleanLet the environment’s (–env) or the image’s (container) collections and roles count: the tree’s ansible.cfg names them after its own, and –install does not install them again. Off, only the tree’s count.
--profilearray of stringActivate a profile (repeatable, comma-separated; ‘*’ for all). Read before the script runs, so it also steers what it declares.
--runnerauto | molecule | ansible-test | playbook
default "auto"
Force a runner instead of picking one.
--skip-requirements
--no-skip-requirements
booleanRun even if this machine lacks the script’s runtime requirements.

The source of this page

    Type to search. ↑ ↓ to move, enter to open.