Hi,
I trying to use environment vars in lookup plugin “hashivault”, but i have the feeling that lookup don’t load environment vars…
Exemple :
- name: USER Create User
tags: account_create_user
environment:
VAULT_ADDR: "{{ vault.url }}"
VAULT_TOKEN: "{{ account_vault.root_token }}"
VAULT_SKIP_VERIFY: true
vars:
vault_path: "/test/{{ item }}"
vault_username: "{{ lookup('hashivault', vault_path, 'username') }}"
vault_password: "{{ lookup('hashivault', vault_path, 'password') }}"
vault_state: "{{ lookup('hashivault', vault_path, 'state') }}"
vault_key: "{{ lookup('hashivault', vault_path, 'key') }}"
account_home: "/home/{{ vault_username }}"
with_items: "{{ account_group_fusion }}"
user:
name: "{{ vault_username }}"
comment: "{{ account_description }}"
shell: "{{ account_shell }}"
password: "{{ vault_password|password_hash('sha512') }}"
groups: "{{ account_groups }}"
createhome: "{{ account_createhome }}"
home: "{{ account_home }}"
state: "{{ vault_state }}"
update_password: "{{ account_reset_password }}"
If i exec with module shell “export VAULT_ADDR”, remote host return the VAULT_ADDR.
But when use it in lookup ({{ lookup(‘pipe’,‘export VAULT_ADDR’) }}), VAULT_ADDR is doesn’t set…
Any idea ?