Skip to content

capable.core221.set_vars

Assign inline variables without changing data trust

Keeps templated inline variables in memory, preserving their Ansible data tags and native types.

Supports namespace and hash-merging options similar to ansible.builtin.include_vars.

On ansible-core 2.21 and later, uses the public variable-layer API for builtin include_vars precedence and nonpersistent variable storage.

Type: int

Accepted for compatibility; has no effect on inline variables.


Type: list

Accepted for compatibility; has no effect on inline variables.


Type: str

Accepted for compatibility; has no effect on inline variables.


Type: str · Choices: merge | replace

Merge strategy for hash variables, as in include_vars. When omitted, uses the controller’s configured hash behaviour.


Type: list

Accepted for compatibility; has no effect on inline variables.


Type: bool

Accepted for compatibility; has no effect on inline variables.


Type: str

Store loaded variables under this key (namespace), as in include_vars.


Type: dict

Variables to set (mapping). When omitted, any task arguments that are not include_vars options are treated as variables to set (set_fact-style shorthand).


- name: Set vars (set_fact-style shorthand)
capable.core221.set_vars:
answer: 42
nested:
hello: world
- name: Set vars with include_vars namespace
capable.core221.set_vars:
name: my_namespace
vars:
answer: 42

Type: dict · Returned: when successful

Variables set by the task (same shape as include_vars result).


  • Kirill Satarin (@kksat)