Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ansible collection "bitwarden.secrets" doesn't seem compatible with bitwarden-sdk 0.1.1 (most recent) #59

Open
dampersand opened this issue Sep 8, 2024 · 1 comment

Comments

@dampersand
Copy link

dampersand commented Sep 8, 2024

Using bitwarden-sdk 0.1.1 (as installed via pip) and the ansible-galaxy collection bitwarden.secrets 1.0.0 (both the current most recent versions) - functionality is just generally broken.

Performing ANY sort of lookup results in the error:

{"msg": "An unhandled exception occurred while running the lookup plugin 'bitwarden.secrets.lookup'. Error was a <class 'AttributeError'>, original message: 'BitwardenClient' object has no attribute 'access_token_login'. 'BitwardenClient' object has no attribute 'access_token_login'"}

Small example code to test:

- name: Bitwarden Secrets Manager Broken Out Of Box
  hosts: localhost

  tasks:
  - name: Create user
    ansible.builtin.user:
      name: "testuser"
      append: true
      create_home: true
      skeleton: true
  - name: upload public key
    ansible.posix.authorized_key:
      exclusive: true
      key: "{{ lookup('bitwarden.secrets.lookup', 'my-very-secret-id') }}"
      user: "testuser"

This is fixable by reverting to bitwarden-sdk 0.1.0

@zbeggs
Copy link

zbeggs commented Sep 13, 2024

Also confirming this bug.

Environment:
WSL2
Ansible - [core 2.16.10]
pip - pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)
pip - bitwarden_sdk 0.1.1

Installed this ansible collection:
ansible-galaxy collection install bitwarden.secrets

Simple ansible playbook

- name: Test Bitwarden lookup
  hosts: localhost
  vars:
    bws_access_token: "{{ lookup('env', 'CUSTOM_ACCESS_TOKEN_VAR') }}"
    secret_id: "redacted"

  tasks:
    - name: Test secret lookup
      ansible.builtin.debug:
        msg: "{{ lookup('bitwarden.secrets.lookup', secret_id) }}" 

Running that playbook gives the same error
{"msg": "An unhandled exception occurred while running the lookup plugin 'bitwarden.secrets.lookup'. Error was a <class 'AttributeError'>, original message: 'BitwardenClient' object has no attribute 'access_token_login'. 'BitwardenClient' object has no attribute 'access_token_login'"}

reverting by installing pip install bitwarden-sdk==0.1.0 fixes the error and the secret is returned successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants