Sounds like maybe an ini-file lookup might be able to get what you want? http://docs.ansible.com/ansible/playbooks_lookups.html#the-ini-file-lookup
Lookups run on the controller so that might be a hindrance depending on where bamboo and ansible are running, but I guess you could allways use 'fetch' to retrieve the file you want to use back onto the controller. Hope this helps, Jon On Saturday, April 8, 2017 at 4:49:52 AM UTC+1, Matt Graham wrote: > > Thanks J > > Thats not a bad idea. It was more of a mini project i was testing my > python/ansible skills on but its also because at the new place Im working > at, they also use the Output from Cloud-formation templates as variables > that are then upload into for Bamboo to use. Bamboo tends to use the format > of > > VPC=vpc-35627 > AWS_REGION=us-east-1 > > My code was going to work something like this > > inlcude_cfn_vars: > stack: name-of-my-stack > stack_prefix: > regex: > > This would add it into the play list instead of having to use a wrapper. I > also allowed it to work with S3 bucket. So, when bamboo uploaded a VARS > file to the S3 buck, you have to sometimes pull that back down and inject > back into Bamboo etc. where I wanted to see if my plugin could do that. > > I just thought there was a function or something to add my vars to the > play like include_vars does. > > > > On Saturday, April 8, 2017 at 4:45:04 AM UTC+10, J Hawkesworth wrote: >> >> I suspect include_vars is an action plugin, as it is the sort of thing >> that only runs on the controller, so isn't a module (which is typically >> delivered to the machines you are managing and run remotely). >> >> However, I'm wondering if the simplest thing to do is just to wrap >> ansible-playbook in your own script that just adds the vars from a file to >> the ansible playbook as a -e @/path/to/some/yaml/or/json/file >> >> I guess you might need to load different vars files for different >> playbooks or something, but just wondering if doing the simples thing might >> be enough. >> >> What is your goal? What problem are you trying to solve. There might be >> a way to solve it without resorting to adding your own custom code on top >> of ansible? >> >> Jon >> >> On Friday, April 7, 2017 at 2:22:18 PM UTC+1, Matt Graham wrote: >>> >>> Hi All >>> >>> Im probably doing this wrong. I'm working on a version of include_vars >>> module where by my variables (based off a text file) get added to the >>> global vars like include_vars >>> >>> Im trying to figure out how I add it. I can see when I use include_vars, >>> that gets added to the global vars >>> >>> I checked that by doing >>> >>> - debug: >>> var: vars >>> >>> and it showed all the run time vars. >>> >>> Hell, I can't seem to find the include_var module to see how its done. >>> Ive tried this variable manager class but I must be doing it all wrong >>> >>> Thanks for any help >>> >>> Regards >>> >>> -- 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/fda239f5-a336-45a0-bc7d-08331ca52e22%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
