[Ansible] op create item --category ssh fails

brchar
brchar
Community Member

Found an interesting and frustrating issue.

I can run op item create --category ssh --vault 'SSH Keys' --title 'My Key' on the ansible host from the terminal or through bash script and it will work

However, if I try to run those same commands/scripts through ansible I get the following error:

"[ERROR] creating items through piped input is not supported for SSH Key items"

Not sure how running an sh script qualifies as piped input.

I want to be able to run the create command through ansible so that I can generate a new key for every new virtual host a create and have it automatically stored in 1password.

I am submitting a Request to ansible to create a 1Password Module that will allow creation, but that may take a while to get someone to do it and get it merged.


1Password Version: CLI-2.23.0
Extension Version: Not Provided
OS Version: Debian Linux 12
Browser: Not Provided

Comments

  • MentalManiac
    MentalManiac
    Community Member
    edited February 17

    I am running into this issue as well. Using ansible to handle key rotations with 1Password as the store. Would really appreciate it being able to work. It was working last year with an older version of the cli, but during that time the command was "op ssh generate"

    EDIT: just wanted to update, adding </dev/null to the end of the command has solved this issue for me

  • OliverGaida
    OliverGaida
    Community Member

    @MentalManiac
    your solution worked for me too, when i was trying op cli within ansible. I got the error "invalid JSON in piped input" it seems to be an open bug on the op cli. see https://1password.community/discussion/comment/641311/#Comment_641311