Getting started with 1Password for your growing team, or refining your setup? Our Secured Success quickstart guide is for you.
Forum Discussion
Former Member
4 years agoGet 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...
Former Member
4 years agoSo apparently someone decided to alter the response of the API and make it much simpler to extract all fields from the item.
Now, instead of doing all that I had to do (described in the comment above), to get to the same result you just need to do this:
```
- name: Get the item
item_info:
item: "{{ vault_title }}"
vault: Ansible
no_log: true
register: smtn
loop: "{{ secrets.fields }}"
- name: Loop into dictionary
set_fact:
password_secrets: "{{ password_secrets | default({}) | combine ({ item.item.label : item.item.value | default('null') }) }}"
loop: '{{ smtn.results }}'
```
That's considerably easier! And I just finished my 1Password role and noticed that it's not working - this is why :) Anyhow, this is much much better!