ansible-modules-hashivault icon indicating copy to clipboard operation
ansible-modules-hashivault copied to clipboard

Idempotency issue for hashivault_auth_ldap & password non set

Open Roxyrob opened this issue 3 years ago • 4 comments

Hi, 'hashivault_approle_role' isn't idempotent.

Probably because of non default mount_path


- name: test
  hosts: localhost
  gather_facts: false

  tasks:
    - hashivault_auth_method:
        token: "{{ lookup('env', 'VAULT_TOKEN') }}"
        url: "{{ lookup('env', 'VAULT_ADDR') }}"
        method_type: "ldap"
        mount_point: "ldaptest"

    - hashivault_auth_ldap:
        token: "{{ lookup('env', 'VAULT_TOKEN') }}"
        url: "{{ lookup('env', 'VAULT_ADDR') }}"
        mount_point: "ldaptest"

running playbook multiple times will always return changed 
TASK [hashivault_approle_role] ********************************************************************************************
changed: [localhost]

Strage behaviors here:

  1. If I change mount point from ldaptest to standard ldap module report ok on every run also if ldap auth method path does not exist.
  2. Also if not idempotent, passing config values seems to correctly config vault ldaptest, but password is not set. Setting same values (with password) with vault cli works fine

Roxyrob avatar Feb 11 '22 00:02 Roxyrob

This code is very manual at constructing desired and current state. The underlying vault or hvac may have changed also since this was created

https://github.com/TerryHowe/ansible-modules-hashivault/blob/main/ansible/modules/hashivault/hashivault_write.py#L122

TerryHowe avatar Feb 11 '22 16:02 TerryHowe

Hi @TerryHowe, this issue is about hashivault_auth_ldap not hashivault_write, I'm missing something ?

Roxyrob avatar Feb 12 '22 03:02 Roxyrob

@TerryHowe any update about this!?!?

emper0r avatar Apr 06 '22 14:04 emper0r

Hi @TerryHowe, my bad for password not set issue, found wrong bind password paramiter name (i erroneously named bindpass instead of bind_pass). Idempotency issue is still present.

Roxyrob avatar Apr 07 '22 07:04 Roxyrob

@TerryHowe, I believe this issue is resolved by merging #417 and can be closed.

ceesios avatar Apr 20 '23 11:04 ceesios

Thanks, fixed in 5.1 as I recall

TerryHowe avatar Apr 20 '23 13:04 TerryHowe