Ansible Lookup Plugin?

Has anybody worked on creating a lookup plugin for Ansible using the new CLI?

I may work on one myself if not, but I don't want to duplicate work that's already done (and open sourced) either. It seems like the Lastpass lookup plugin that's already distributed with Ansible could be used as a starting point:
https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/lookup/lastpass.py


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

Comments

  • rickfillionrickfillion Junior Member

    AgileBits Team Member

    I'm not aware of such a plugin being developed by anyone. Ansible seems neat though, I hadn't heard of it before today.

    Rick

  • FYI, I've gone ahead and built this myself. Will be open sourcing it shortly and/or contributing it to Ansible core. Just a heads up to anybody who finds this thread.

  • rickfillionrickfillion Junior Member

    AgileBits Team Member

    That's awesome. We'd love to hear about it when it's available.

    Rick

  • I have submitted this as a pull request, hopefully to be distributed with Ansible:
    https://github.com/ansible/ansible/pull/37207

    If it gets rejected for some reason, then I will bundle it up as a plugin for others to install via Galaxy.

  • rickfillionrickfillion Junior Member

    AgileBits Team Member

    Woo! Here's to hoping they merge the pull request. :)

    Rick

  • cohixcohix

    AgileBits Team Member

    @scottsb I reviewed the PR, looks really great :)

  • sam.doransam.doran Junior Member
    edited March 10

    I’m an Ansible Core developer. I'll review the PR and see about getting it merged.

  • sam.doransam.doran Junior Member
    edited March 10

    Since you can also edit items with the 1Password CLI it would also be feasible to create modules to create, update, and delete 1Password records. This would make 1Password a first-class secret management tool alongside other "big name" secret stores. I like the implications of this.

  • rickfillionrickfillion Junior Member

    AgileBits Team Member

    Unfortunately we can't actually edit items yet with op. Most of the lower level work needed to make that happen is there (it's so similar to creation). One of the things we've been having trouble with is just how to expose this to users. To be honest, I'm not a big fan of how op create item works, and I think we need to reconsider how it works. Every item has effectively 3 parts: the item metadata (createdAt, updatedAt, etc...) which isn't encrypted, the item overview (contains things like title, urls, tags) which is encrypted, and item details (everything really interesting goes in there) which is also encrypted. Currently op create item has you give it only the details, and then specify a few of the fields you can put in the overview as flags.

    My gut says that we need to redo things all the way back to op get template and have that command return you a structure that looks just like op get item would, except empty. Then you'd pass that whole structure (which includes metadata, overview, details) over to op create item. If we did that, then op update item could work exactly the same and the world would be a beautiful place.

    Rick

  • MrCMrC Community Moderator

    Yes! @rickfillion ,

    I've been contemplating the road path to providing my converter suite with the ability to submit entries directly via op create item, but I don't think the CLI is ready for that yet. There does need to be a structure that supports packaging the metadata, key field data, notes, and perhaps even attachments (+ internal linking).

  • rickfillionrickfillion Junior Member

    AgileBits Team Member

    God that'd be hot, @MrC.

    Rick

  • scottsbscottsb
    edited May 17

    FYI, the Ansible lookup plugin for 1PW was merged today. Thanks to @sam.doran for help with that. Planned for Ansible 2.6, which is anticipated to release as stable on June 28.

  • rickfillionrickfillion Junior Member

    AgileBits Team Member

    Way to go @scottsb and @sam.doran! That's awesome.

    Rick

Leave a Comment

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