Unfortunately it seems like include_vars only looks for the vars file on the ansible server, and will not fetch it on the remote server. Trying to elegantly handle these cases ended up becoming a huge mess.
I ended up just creating my own action plugin that pulls the a key/value parameter and adds them as a fact. Unfortunately i can't actually figure out how to get Ansible to properly use my action plugin without shoving it in the ansible install directory. Action plugins in plugin directory seem to be ignored. On Wednesday, September 23, 2015 at 3:39:24 AM UTC-4, George Boobyer wrote: > > This might provide some inspiration, where a vars file is templated and > then included allowing dynamic variable names and values. > I think it would be 'more elegant' to build up an in memory YAML/JSON as > opposed to creating a file - but haven't got a good example - so hope this > helps! and it may prompt some 'better' suggestions! ; ) > https://groups.google.com/d/msg/ansible-project/X1Q93QOk6Ew/ZygP5rXmfEkJ > > On Tuesday, September 22, 2015 at 12:49:13 AM UTC+1, Frank Perks wrote: >> >> I am trying to shrink ~30+ roles into a single role to drastically reduce >> the amount of duplicate and copy and pasted code into a single nice and >> neat role. One of the problems is each role sets a specifically named fact >> basically like: >> >> ec2_<appname>_foo >> >> What i want to do is this: >> >> set_fact: >> "{{ some var }}" : "{{ some value }}" >> >> The problem is that i can't seem to figure out how to do this. Now i know >> i could simply on the playbook task, copy the value into its corresponding >> var through set_fact. However a lot of the roles are run one after another, >> so that doesn't really work. >> >> I was thinking i could just setup redis and push the fact there >> temporarily, however that seems like a lot of work. >> > -- 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 post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/8fc5e78f-5cb4-47c0-bb67-5ce806eb638f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
