Searching for Item by name / field in Ansible Connect

I've just started using connect, and it's a terrific feature, it will solve loads of problems.

I'm just wondering if the ansible plugin has a way to search? Or if you can get things solely by name?
If so then perhaps I would be better using the CLI Plugin?

1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Connect 2.0.0 Docker
Sync Type: Connect
Referrer: forum-search:ansible


  • David_agDavid_ag

    Team Member


    Yes, the Ansible collection does have a search plugin: . If you have a specific use case in mind, I can also recommend a few approaches.

    You can use it to get information about a specific item using just the item's name. You can also search for a field within an item if you want just a specific value.

    For example:

      hosts: localhost
        OP_CONNECT_HOST: http://localhost:8080
        OP_CONNECT_TOKEN: ""
        - onepassword.connect
        - name: Find the item with the label "Staging Database" in the vault "Staging Env"
            item: Staging Database
            vault: Staging Env   # You can limit the search to a specific vault, too!
          no_log: true
          register: op_item

    This playbook will:

    • contact the 1Password Connect server in your infrastructure
    • make a GET request to find the item with the name "Staging Database"
    • register the result to op_item if the item can be found

    You can then access the returned item data in the rest of your play book. You could get the item's ID by accessing or reference a field by name via op_item.fields.yourFieldNameHere

  • HI David,

    Thanks, but what about if I was to search by a different field other than Name?

    For example if I was to add a field called hostname, or IP, and then wanted to search where the IP was 192.168.X.X

    Kind Regards


  • David_agDavid_ag

    Team Member

    Hey Mike,

    Right now we only support searching by field name. I can suggest you open an issue on the GitHub repo and we can gather some interest on searching for field(s) by value with the Ansible module.

    We can definitely consider adding support to filter items by their tags, too. Would that be a viable alternative?

  • Will do, thanks David

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file