Cannot get op to create a login with ansible

zigfordzigford
Community Member

Hello kind folk.
I'm enjoying op cli.
I'm generating unique passwords for multiple accounts across a fleet of servers once every 6 months or so.
I have an ansible playbook that successfully reads creates unique passwords and updates the hosts.
The playbook also is successfully checking 1password and comparing the new password with the password stored in the vault to determine is the password needs to be updated in 1 password. (So I can successfully read passwords using op cli, in an ansible playbook.

The problem begins when I try and update a password.
I'm using the template json method where ansible is generating a json file for the item and posting it. This work fine in a script or on the command line, but as soon as I try to get ansible to run it, the op cli returns nothing and no password is updated/created.
There are no errors or messages printed to stdout using --debug returns no output
Any ideas why this might be the case?

I did an strace of the op command on running through bash and ansible and the run through ansible ends early at this line:

fstat(0, {st_dev=makedev(0, 0xd), st_ino=328608, st_mode=S_IFIFO|0600, st_nlink=1, st_uid=1000, st_gid=1000, st_blksize=4096, st_blocks=0, st_size=0, st_atime=1657842933 /* 2022-07-15T09:55:33.711820584+1000 */, st_atime_nsec=711820584, st_mtime=1657842933 /* 2022-07-15T09:55:33.711820584+1000 */, st_mtime_nsec=711820584, st_ctime=1657842933 /* 2022-07-15T09:55:33.711820584+1000 */, st_ctime_nsec=711820584}) = 0

Whereas, the line appears like this in the successful run:

fstat(0, {st_dev=makedev(0, 0x17), st_ino=5, st_mode=S_IFCHR|0620, st_nlink=1, st_uid=1000, st_gid=5, st_blksize=1024, st_blocks=0, st_rdev=makedev(0x88, 0x2), st_atime=1657844008 /* 2022-07-15T10:13:28.912972426+1000 */, st_atime_nsec=912972426, st_mtime=1657844008 /* 2022-07-15T10:13:28.912972426+1000 */, st_mtime_nsec=912972426, st_ctime=1657826569 /* 2022-07-15T05:22:49.912972426+1000 */, st_ctime_nsec=912972426}) = 0

I'm using op cli 2.5.1


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

Comments

  • Horia.Culea_1PHoria.Culea_1P

    Team Member

    Hey @zigford ,

    Thank you for reporting this. Without any logs, this may be a bit tedious to diagnose, but we can definitely try.

    A while go, we encountered a bug that caused, in certain environments, the CLI to interpret a programatic call as receiving piped input when it's not present, in fact.

    My hunch is that it might be related to this. Would it be possible for you the syntax of your command from

    op item create --template item.json <assignments> <flags>
    

    to

    cat item.json | op item create <assignments> <flags>
    

    ?

    Please let us know if this helps or if at least produces a more verbose error.

    Looking forward to hearing from you.
    Best,
    Horia

  • zigfordzigford
    Community Member

    @Horia.Culea_1P
    Thanks very much for your suggestion. Using that method worked perfectly.

  • Horia.Culea_1PHoria.Culea_1P

    Team Member

    I'm glad this helped. We'll make sure to update you when any developments related to this presumed bug are made.
    Thank you once again for reporting this!

    Best,
    Horia

Leave a Comment

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