Hindsight is always 20:20 😊
From: [email protected] <[email protected]> On
Behalf Of Joe Langdon
Sent: Thursday, August 22, 2019 8:24 AM
To: [email protected]
Subject: Re: [ansible-project] More dynamic variables
Seems perfect time to ask a question to me. You tried everything you could on
your own. Life always looks easy after you are given the answer but by design
is a struggle to get there :-)
On Thu, Aug 22, 2019 at 11:13 AM 'Mark Tovey - DSV' via Ansible Project
<[email protected]<mailto:[email protected]>>
wrote:
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]<mailto:[email protected]>
<[email protected]<mailto:[email protected]>> On
Behalf Of James Cassell
Sent: Wednesday, August 21, 2019 5:40 PM
To: Ansible List
<[email protected]<mailto:[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&data=02%7C01%7Cmark.tovey%40dsv.com%7Cdf650068757d41204efd08d726996758%7C4a90c23a3ece4ef2b857522f23b8204c%7C0%7C0%7C637020312615190322&sdata=mf6GSzlqRmyEOcQC%2B6TSE%2BzW4sTSy9rMPrAcDSLOh2A%3D&reserved=0<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Ftopic%2Fansible-project%2FruVlyYr06d8%2Funsubscribe&data=02%7C01%7Cmark.tovey%40dsv.com%7Ca0a9f9887eed44afdd3b08d72714d328%7C4a90c23a3ece4ef2b857522f23b8204c%7C0%7C0%7C637020842700667727&sdata=Dptcm0u0XVhjJcdXGpyT7fN0UD2Mg49z4UKAm2%2FvkDU%3D&reserved=0>.
To unsubscribe from this group and all its topics, send an email to
[email protected]<mailto:ansible-project%[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&data=02%7C01%7Cmark.tovey%40dsv.com%7Cdf650068757d41204efd08d726996758%7C4a90c23a3ece4ef2b857522f23b8204c%7C0%7C0%7C637020312615200321&sdata=LP6Y0%2B7%2FLmG8dAukPvIk5NH2yWWcOiQFRjOEWDmH3pY%3D&reserved=0<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&data=02%7C01%7Cmark.tovey%40dsv.com%7Ca0a9f9887eed44afdd3b08d72714d328%7C4a90c23a3ece4ef2b857522f23b8204c%7C0%7C0%7C637020842700677719&sdata=ShrENWBSqB72ZYpPMVBeiqwk32JIz6lUUkFz97Ob6gk%3D&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]<mailto:ansible-project%[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/AM5PR0602MB2771EDE997589AD46EC3BB519EA50%40AM5PR0602MB2771.eurprd06.prod.outlook.com<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2FAM5PR0602MB2771EDE997589AD46EC3BB519EA50%2540AM5PR0602MB2771.eurprd06.prod.outlook.com&data=02%7C01%7Cmark.tovey%40dsv.com%7Ca0a9f9887eed44afdd3b08d72714d328%7C4a90c23a3ece4ef2b857522f23b8204c%7C0%7C0%7C637020842700687713&sdata=V9lnwhqvN%2FSE%2BdzbLbGnkub3Xcuyz%2FyKnHM%2B8YyFNsU%3D&reserved=0>.
--
Joe Langdon
Sometimes when you think life is kicking you in the ass, it's actually just
moving you quickly to a better place.
--
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://groups.google.com/d/topic/ansible-project/ruVlyYr06d8/unsubscribe<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Ftopic%2Fansible-project%2FruVlyYr06d8%2Funsubscribe&data=02%7C01%7Cmark.tovey%40dsv.com%7Ca0a9f9887eed44afdd3b08d72714d328%7C4a90c23a3ece4ef2b857522f23b8204c%7C0%7C0%7C637020842700687713&sdata=tH8AgMbsfTByVBTGGBcbllxKm79Er2mcBeeMsnj96Lg%3D&reserved=0>.
To unsubscribe from this group and all its topics, send an email to
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAL_P1G9K-%3DmH_g_3O%2BzzH1TKNM9dMtd9mHmsvO-XjUh1x_tMbg%40mail.gmail.com<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2FCAL_P1G9K-%253DmH_g_3O%252BzzH1TKNM9dMtd9mHmsvO-XjUh1x_tMbg%2540mail.gmail.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=02%7C01%7Cmark.tovey%40dsv.com%7Ca0a9f9887eed44afdd3b08d72714d328%7C4a90c23a3ece4ef2b857522f23b8204c%7C0%7C0%7C637020842700697710&sdata=A8%2FDnuvMVBZl2pYkxCZT882U3U4EOK5R0LyBZ2gDjQc%3D&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/AM5PR0602MB2771995C8AC14DE1012135769EA50%40AM5PR0602MB2771.eurprd06.prod.outlook.com.