Reference

Declarations

The calls a script is made of, with their arguments: each is a Declaration schema in the contract.

These are the calls that declare something, as the contract has them: a program can build a script from data, check it against the schema before anything runs, and write it out as a real instamix script.

The types are the schema’s, so they are JSON’s: string where Python has str, object for a dict, array for a list. In Python some arguments take more than JSON can say – the shape of a var() is anything glom’s Match takes, and a stage() takes the file() it runs.

Python only#

What a script uses from Python, and the contract has no schema for:

NameWhat it is
with profile(name), enabled(name)profiles: gate declarations, or branch on one
@only_under(name), register_profile(name, provides=)gate a function, or an API name, to a profile
@check(name=, only=)a check of your own over the tree
play(hosts, ...)one play, for playbook()
Template, NonEmpty(shape)shapes for var()
repo(name)put a playbook repository on the import path
script_sha256()the script’s own SHA-256, for proxy_list()
archive(dest, compression=None)write a tar archive

collection#

collection(name, meta=, only=, plugins=, roles=, version=)

Lay out a local collection.

ArgumentTakesWhat it is
namestring
needed
metaobject
onlyOnlyThe profiles it belongs to, like with profile(...).
pluginsobject
rolesobjectrole name -> role() arguments
versionstring
default "1.0.0"

container_image#

container_image(ref, only=)

The container image imix container runs the playbooks in.

ArgumentTakesWhat it is
refstring
needed
onlyOnlyThe profiles it belongs to, like with profile(...).

file#

file(path, content=, mode=, only=)

Declare one file.

ArgumentTakesWhat it is
pathstring
needed
contentContent
modeinteger | nullUnix permission bits, or null for the default (0644).
onlyOnlyThe profiles it belongs to, like with profile(...).

group#

group(name, description, children=, hosts=, only=, vars=)

Describe a host group; the inventory is written from the groups.

ArgumentTakesWhat it is
namestring
needed
descriptionstring
needed
childrenarray of stringThe groups nested in it.
hostsarray | objectHost names, or host -> inventory variables.
onlyOnlyThe profiles it belongs to, like with profile(...).
varsobject

group_vars#

group_vars(group, data=, only=)

Variables for a group.

ArgumentTakesWhat it is
groupstring
needed
dataobject
onlyOnlyThe profiles it belongs to, like with profile(...).

host_vars#

host_vars(host, data=, only=)

Variables for a host.

ArgumentTakesWhat it is
hoststring
needed
dataobject
onlyOnlyThe profiles it belongs to, like with profile(...).

include#

include(src, dest=, only=)

Read a file off disk.

ArgumentTakesWhat it is
srcstring
needed
deststring
onlyOnlyThe profiles it belongs to, like with profile(...).

include_tree#

include_tree(src, dest=, only=)

Read a directory off disk.

ArgumentTakesWhat it is
srcstring
needed
deststring
onlyOnlyThe profiles it belongs to, like with profile(...).

integration_test#

integration_test(target, aliases=, collection=, only=, tasks=)

An ansible-test integration target.

ArgumentTakesWhat it is
targetstring
needed
aliasesarray of string
collectionstring
onlyOnlyThe profiles it belongs to, like with profile(...).
tasksarray of object

inventory#

inventory(groups=, only=, path=)

An INI inventory from groups.

ArgumentTakesWhat it is
groupsobjectgroup -> host list, or {hosts, vars, children}
onlyOnlyThe profiles it belongs to, like with profile(...).
pathstring
default "inventory"

molecule#

molecule(config=, converge=, driver=, image=, only=, platforms=, role=, scenario=, verify=)

A molecule scenario, for the repo or one role.

ArgumentTakesWhat it is
configobject
convergearray of object
driverstring
default "podman"
imagestring
default "quay.io/centos/centos:stream9"
onlyOnlyThe profiles it belongs to, like with profile(...).
platformsarray of object
rolestring
scenariostring
default "default"
verifyarray of object

playbook#

playbook(only=, path=, plays=)

Declare a playbook from plays.

ArgumentTakesWhat it is
onlyOnlyThe profiles it belongs to, like with profile(...).
pathstring
default "site.yml"
playsarray of Play

proxy_list#

proxy_list(name, only=)

Fetch collections, roles and pip packages through this list of the instamix proxy ($INSTAMIX_PROXY).

ArgumentTakesWhat it is
namestring
needed
onlyOnlyThe profiles it belongs to, like with profile(...).

requires_ansible#

requires_ansible(spec, only=)

Need an ansible-core version on the controller.

ArgumentTakesWhat it is
specstring
needed
onlyOnlyThe profiles it belongs to, like with profile(...).

requires_base#

requires_base(name, only=)

Start the environment from a base: what a community execution environment puts on the controller (instamix_bases.BASES). A script’s own collections and roles go into its tree, never the environment.

ArgumentTakesWhat it is
nameminimal | base
needed
onlyOnlyThe profiles it belongs to, like with profile(...).

requires_collection#

requires_collection(name, only=, signatures=, source=, type=, version=)

Depend on a galaxy collection.

ArgumentTakesWhat it is
namestring
needed
onlyOnlyThe profiles it belongs to, like with profile(...).
signaturesarray of string
sourcestring
typestring
versionstring

requires_command#

requires_command(names, only=)

Need programs on PATH.

ArgumentTakesWhat it is
namesarray of string
needed
onlyOnlyThe profiles it belongs to, like with profile(...).

requires_pip#

requires_pip(packages, only=)

Need Python packages next to ansible (also written to requirements.txt).

ArgumentTakesWhat it is
packagesarray of string
needed
onlyOnlyThe profiles it belongs to, like with profile(...).

requires_python#

requires_python(spec, only=)

Need a Python version for ansible itself.

ArgumentTakesWhat it is
specstring
needed
onlyOnlyThe profiles it belongs to, like with profile(...).

requires_role#

requires_role(name, only=, scm=, src=, version=)

Depend on a galaxy role.

ArgumentTakesWhat it is
namestring
needed
onlyOnlyThe profiles it belongs to, like with profile(...).
scmstring
srcstring
versionstring

role#

role(name, collection=, defaults=, files=, handlers=, meta=, only=, tasks=, templates=, tests=, vars=)

Lay out a role; only the parts given are written.

ArgumentTakesWhat it is
namestring
needed
collectionstringPut the role in this local collection (ns.name).
defaultsobject
filesobject
handlersarray of object
metaobject
onlyOnlyThe profiles it belongs to, like with profile(...).
tasksarray of object
templatesobject
testsarray of objectTasks, or plays, for tests/test.yml.
varsobject

stage#

stage(name, description, only=, playbook=, tags=, when=)

Describe a stage: a declared playbook that site.yml imports under a tag of the stage’s name.

ArgumentTakesWhat it is
namestring
needed
descriptionstring
needed
onlyOnlyThe profiles it belongs to, like with profile(...).
playbookstringDefault: NAME.yml.
tagsarray of stringMore tags to run it under.
whenanyA condition, as on a task.

tag#

tag(name, description, only=)

Describe a tag: what running it alone does.

ArgumentTakesWhat it is
namestring
needed
descriptionstring
needed
onlyOnlyThe profiles it belongs to, like with profile(...).

unit_test#

unit_test(path, content, collection=, only=)

A file under tests/unit.

ArgumentTakesWhat it is
pathstring
needed
contentContent
needed
collectionstring
onlyOnlyThe profiles it belongs to, like with profile(...).

var#

var(name, description, default=, group=, only=, optional=, shape=)

Describe a variable the playbooks need. A default goes into the group’s group_vars; without one a group has to set it, unless it is optional.

ArgumentTakesWhat it is
namestring
needed
descriptionstring
needed
defaultanyThe value in the group’s group_vars.
groupstring
default "all"
onlyOnlyThe profiles it belongs to, like with profile(...).
optionalboolean
default false
shapestr | int | float | bool | list | dict
default "str"
In Python, anything glom’s Match takes: a type, a list or dict of shapes, Or(…).

The source of this page

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