Get multiple items from the vault using Ansible loop
So, I am wondering if there is a way to get multiple items from the vault at once?
Here is the issue - I have a playbook with 20 or 30 secrets that are going to be stored inside 1Password. What I really want to avoid is writing the same item_info task 30 times.
Instead, I've made the following:
secrets:
title: Random item
fields:
- var: some_label
definition:
label: Some Label
value: "the value"
section: "Personal Info"
field_type: concealed
- var: dashboard_password
definition:
label: Dashboard Password
generate_value: on_create
generator_recipe:
length: 16
include_symbols: no
It works perfectly for creating items inside 1Password vault, but I also want to be able to retrieve all these values using Ansible loop, something like this:
- name: Get the item
item_info:
item: "{{ vault_title }}"
field: "{{ item.definition.label }}"
vault: Ansible
no_log: true
register: "{{ item.definition.var }}"
loop: "{{ secrets.fields }}"
The problem is that registered var names are not templatable, so the task above is going to fail.
So, is there any other way of doing this?
1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
