Re: [ansible-project] How do I nest lookup calls

2016-09-16 Thread ZillaYT
That was so obvious that i didn't see it, thanks!!! Yes it worked. I was 
just wanting to use home_dir somewhere else, but this gets me going.

On Friday, September 16, 2016 at 3:27:09 PM UTC-4, Kai Stian Olstad wrote:
>
> On 16. sep. 2016 20:50, ZillaYT wrote: 
> > From How to set environment variable with value obtained from 
> > ~/.aws/credentials? 
> >  
> I'm 
> > using lookup to get the values from a file off my home directory. But 
> how 
> > do I nest the result of one lookup call into a subsequent lookup call? 
> In 
> > the following code, I want to use the value of home_dir in the 
> subsequent 
> > lookups. 
> > 
> > - name: Set AWS variables 
> >   set_fact: 
> > home_dir: lookup('env', 'HOME') 
> > aws_access_key_id: "{{ lookup('ini', 'aws_access_key_id 
> section=default file=home_dir/.aws/credentials') }}" 
> > aws_secret_access_key: "{{ lookup('ini', 'aws_secret_access_key 
> section=default file=home_dir/.aws/credentials') }}" 
>
> If you use file=~/.aws/credentials it will work. 
>
> -- 
> 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/2b6519e6-77c7-479d-89be-99726d260fba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] How do I nest lookup calls

2016-09-16 Thread Kai Stian Olstad

On 16. sep. 2016 20:50, ZillaYT wrote:

From How to set environment variable with value obtained from
~/.aws/credentials?
 I'm
using lookup to get the values from a file off my home directory. But how
do I nest the result of one lookup call into a subsequent lookup call? In
the following code, I want to use the value of home_dir in the subsequent
lookups.

- name: Set AWS variables
  set_fact:
home_dir: lookup('env', 'HOME')
aws_access_key_id: "{{ lookup('ini', 'aws_access_key_id section=default 
file=home_dir/.aws/credentials') }}"
aws_secret_access_key: "{{ lookup('ini', 'aws_secret_access_key section=default 
file=home_dir/.aws/credentials') }}"


If you use file=~/.aws/credentials it will work.

--
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/eda2c710-b269-1c9f-c106-0acaaa6d4cac%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] How do I nest lookup calls

2016-09-16 Thread ZillaYT
>From How to set environment variable with value obtained from 
~/.aws/credentials? 
 I'm 
using lookup to get the values from a file off my home directory. But how 
do I nest the result of one lookup call into a subsequent lookup call? In 
the following code, I want to use the value of home_dir in the subsequent 
lookups.

- name: Set AWS variables
  set_fact: 
home_dir: lookup('env', 'HOME') 
aws_access_key_id: "{{ lookup('ini', 'aws_access_key_id section=default 
file=home_dir/.aws/credentials') }}" 
aws_secret_access_key: "{{ lookup('ini', 'aws_secret_access_key 
section=default file=home_dir/.aws/credentials') }}"


The above code gives


An exception occurred during task execution. To see the full traceback, use 
-vvv. The error was: IOError: [Errno 2] No such file or directory: u
'/home/myUser//andible_subdir/home_dir/.aws/credentials'
fatal: [10.22.9.4]: FAILED! => {"failed": true, "msg": "Unexpected failure 
during module execution.", "stdout": ""}


-- 
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/c024c891-fda9-47f8-8a54-d4f0f562a94b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.