We’re happy to announce a new drop of the fallible experimental Ansible build, and are looking for your feedback! This one contains previews of a couple of features currently slated for release in Ansible Core 2.21:
- Register Projections allows the
registerkeyword to set multiple vars using the result of arbitrary Jinja expressions. It adds a new implicit variable (_task) for theregisterkeyword and task conditionals (e.g.,failed_when,changed_when,break_when,until) to directly access the most recent task/loop results from Jinja expressions, as well as access to all previously-executed loop results (not just the most recent). This feature allows for more concise playbooks by collapsing the common “run a task,set_factto stuff the interesting bits of the result into new vars” pattern into a single task. - Action APIs for dynamic creation of hosts/groups and registration of top-level variables without
ansible_facts(basically “write your ownadd_host,group_by, andset_fact”).
Huge props to @mattclay and @pkingstonxyz for the numerous hours spent with me solidifying the features to this point, to @sivel for bashing out the first couple iterations that we’d been handwaving about for so long, and to @mkrizek for the initial draft of the new Action API.
As with all fallible releases, this is completely unsupported, not a promise to ship anything in particular, might kick your dog, etc., but we’d love to hear your feedback on these features, since it’s still early enough to make changes. Some minimal examples and explanation can be found on the PR - a bit sparse at the moment, but hopefully enough to get the idea.
Get it from PyPI with pip install fallible if you want a side-by-side installation with existing Ansible Core (where the CLI tools are all s/ansible/fallible/, e.g. fallible-playbook ...), or pip install fallible[compat] if you want it to answer on the normal ansible-* CLI entrypoints.
Many of us are taking time off for the holidays, but feel free to discuss here or leave feedback on the PR if you’ve tried it and love it, hate it, it broke your world, or if you’ve got constructive feedback to share. We’ll follow up in January (if not before).
On behalf of the Ansible Core Team, thanks for being such an engaging community, and happy holidays!