community.sops.load_vars – Load sops-encrypted variables from files, dynamically within a task¶
Note
This plugin is part of the community.sops collection (version 1.0.6).
To install it use: ansible-galaxy collection install community.sops
.
To use it in a playbook, specify: community.sops.load_vars
.
New in version 0.1.0: of community.sops
Synopsis¶
Loads sops-encrypted YAML/JSON variables dynamically from a file during task runtime.
To assign included variables to a different host than
inventory_hostname
, usedelegate_to
and setdelegate_facts=yes
.
Note
This module has a corresponding action plugin.
Parameters¶
See Also¶
See also
- ansible.builtin.set_fact
The official documentation on the ansible.builtin.set_fact module.
- ansible.builtin.include_vars
The official documentation on the ansible.builtin.include_vars module.
- Controlling where tasks run: delegation and local actions
More information related to task delegation.
Examples¶
- name: Include variables of stuff.sops.yaml into the 'stuff' variable
community.sops.load_vars:
file: stuff.sops.yaml
name: stuff
expressions: evaluate-on-load # interpret Jinja2 expressions in stuf.sops.yaml on load-time!
- name: Conditionally decide to load in variables into 'plans' when x is 0, otherwise do not
community.sops.load_vars:
file: contingency_plan.sops.yaml
name: plans
expressions: ignore # do not interpret possible Jinja2 expressions
when: x == 0
- name: Load variables into the global namespace
community.sops.load_vars:
file: contingency_plan.sops.yaml
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
ansible_included_var_files
list
/ elements=string
|
success |
A list of files that were successfully included
Sample:
['/path/to/file.sops.yaml']
|
Authors¶
Felix Fontein (@felixfontein)