On Monday, 5 March 2018 18.47.09 CET K S-Dean wrote:
> "{{ lookup('vault', 'pki/issue/webserver common_name=\"test.example.com\" 
>  ip_sans=\"{{ IP_ADDR }}, {{ 
> var=hostvars[inventory_hostname].ansible_ssh_host }}\" format=\"pem\" 
> key_bits=4096').certificate }}"
> 
> Hi im trying to use a variable inside a lookup statement which I'm using to 
> query vault 
> 
> I'm using the following plugin https://github.com/jhaals/ansible-vault
> 
> Now i've tried it with {{ variable }}, + variable +, var=variable but none 
> of these seem to work and i don't know the correct format. 
> 
> Is this possible ?

Curly brackets doesn't stack so you can't use {{ }} inside {{ }}
So something like this should work.

{{ lookup('vault', 'pki/issue/webserver common_name=test.example.com ip_sans=' 
~ IP_ADDR ~ ' var=' ~ hostvars[inventory_hostname].ansible_ssh_host ~ ' 
format=pem key_bits=4096').certificate }}"


-- 
Kai Stian Olstad

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/69114327.8JVcTuezkO%40x1.
For more options, visit https://groups.google.com/d/optout.

Reply via email to