Forum Discussion

Former Member's avatar
Former Member
4 years ago

Pull out whole item/file via Ansible from vault

Is there possiblity to pull whole item as a file out from vault via Ansible integration?

https://github.com/1Password/ansible-onepasswordconnect-collection

Is there any examples how to do it?

Thanks!


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided

2 Replies

  • Former Member's avatar
    Former Member

    hello,

    That is not unfortunately what Im after. They made issue out of it: https://github.com/1Password/ansible-onepasswordconnect-collection/issues/53

  • Former Member's avatar
    Former Member

    Hi @frankvisma,

    My apologies for the late response. I am not an Ansible expert, but I'd expect something like this to work:

    hosts: localhost
    environment:
    OP_CONNECT_HOST: http://localhost:8001
    OP_CONNECT_TOKEN: "valid.jwt.here"
    collections:
    - onepassword.connect
    tasks:
    - name: Find the item with the label "Staging Database" in the vault "Staging Env"
    item_info:
    item: Staging Database
    vault: Staging Env
    no_log: true
    register: op_item
    - local_action: copy content={{ op_item }} dest=/path/to/destination/file

    You can see the contents of {{ op_item }} in the collapses section in https://github.com/1Password/ansible-onepasswordconnect-collection#example-usage-1.

    Let me know if that works for you.