As usual, the answer is simple.  I was trying to trying to include 
".configdir" inside of the lookup plugin call. And now that I am looking at a 
working solution, I can see how this works.  I can be very obtuse sometimes.
    Thanks again.
    -Mark


-----Original Message-----
From: [email protected] <[email protected]> On 
Behalf Of James Cassell
Sent: Wednesday, August 21, 2019 5:40 PM
To: Ansible List <[email protected]>
Subject: Re: [ansible-project] More dynamic variables

On Wed, Aug 21, 2019, at 2:35 PM, 'Mark Tovey' via Ansible Project wrote:
> 
>  I hate having to constantly go here to solve issues like this, 
> especially when the issues I keep presenting are all so similar, but 
> eventually I have to just give up trying to solve this on my own and 
> ask.
> 
>  I want to define a structure in a vars file that looks like the following:
> 
> > myos: {
> >  configdir: "/path/to/directory",
> >  configfile: "filename"
> > }
> > my_configdir: "{{ansible_facts.distribution}}.configdir"

my_configdir: "{{ (lookup('vars' ansible_facts.distribution)).configdir }}"

And so on...

> > my_configfile: "{{ansible_facts.configfile}}.configfile"
> 
> 
>  I want to do something similar to the following:
> 
> > stat:
> >  path: "{{my_configdir}}/{{my_configfile}}"
> >  register: result
>  Unfortunately, path is being resolved to 
> "myos.configdir/myos.configfile", not the expected 
> "/path/to/directory/filename". I have tried using various methods of 
> concatenating variables together, including trying the 'vars' lookup 
> plugin, but I have not been able to work this out after two days of 
> trying. So, here I am, back at the well, looking for another answer.
> Does anyone have any advice?
> 
> 

V/r,
James Cassell

--
You received this message because you are subscribed to a topic in the Google 
Groups "Ansible Project" group.
To unsubscribe from this topic, visit 
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Ftopic%2Fansible-project%2FruVlyYr06d8%2Funsubscribe&amp;data=02%7C01%7Cmark.tovey%40dsv.com%7Cdf650068757d41204efd08d726996758%7C4a90c23a3ece4ef2b857522f23b8204c%7C0%7C0%7C637020312615190322&amp;sdata=mf6GSzlqRmyEOcQC%2B6TSE%2BzW4sTSy9rMPrAcDSLOh2A%3D&amp;reserved=0.
To unsubscribe from this group and all its topics, send an email to 
[email protected].
To view this discussion on the web visit 
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2Fead8c9e9-b513-4dce-a8d9-af683500a4b4%2540www.fastmail.com&amp;data=02%7C01%7Cmark.tovey%40dsv.com%7Cdf650068757d41204efd08d726996758%7C4a90c23a3ece4ef2b857522f23b8204c%7C0%7C0%7C637020312615200321&amp;sdata=LP6Y0%2B7%2FLmG8dAukPvIk5NH2yWWcOiQFRjOEWDmH3pY%3D&amp;reserved=0.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/AM5PR0602MB2771EDE997589AD46EC3BB519EA50%40AM5PR0602MB2771.eurprd06.prod.outlook.com.

Reply via email to