Thanks Matt, overlooked that obvious detail (need more coffee). So, following the vars_files documentation I am still struggling.
*vars/main.yml* *vars_files:* * - imagenames.yml* *vars/imagenames.yml* *centos64: 52225cb3-441b-47b6-9cca-deb14d24d72f* *> ansible-playbook vm.ymlPLAY [admin-vm] ***************************************************************TASK: [provision | Creating virtual machine instances] ************************fatal: [10.0.0.6] => One or more undefined variables: 'centos64' is undefinedFATAL: all hosts have already failed -- abortingPLAY RECAP ******************************************************************** to retry, use: --limit @/root/vm.retry10.0.0.6 : ok=0 changed=0 unreachable=1 failed=0* I have tried using a relative and absolute paths to imagenames.yml with no luck. Thanks Albion On Friday, January 17, 2014 9:17:44 AM UTC-8, Matt Martz wrote: > > include_vars is a module that should be executed under a 'tasks' section. > > What I believe you are looking for is vars_files. > > See > http://docs.ansible.com/playbooks_variables.html#variable-file-separation > -- > Matt Martz > [email protected] <javascript:> > > On January 17, 2014 at 11:14:10 AM, AmiableAlbion > ([email protected]<javascript:>) > wrote: > > I am struggling to break out variables in the "var" directory of roles > into individual files > > I have tried and continue to get tracebacks. I thought this would be > straight forward after seeing the documentation for include_vars, but > evidently I am missing something here. > > I was trying something like this with Ansible 1.4.4 > > *vars/main.yml* > *- include_vars: credentials.yml* > *- include_vars: imagenames.yml* > > *vars/imagenames.yml* > > *centos64: 52225cb3-441b-47b6-9cca-deb14d24d72f* > *rhel64: 364cd1c1-e958-4327-a0b4-3251da47869c* > > *> ansible-playbook vm.yml* > *Traceback (most recent call last):* > * File "/usr/bin/ansible-playbook", line 269, in <module>* > * sys.exit(main(sys.argv[1:]))* > * File "/usr/bin/ansible-playbook", line 209, in main* > * pb.run()* > * File "/usr/lib/python2.6/site-packages/ansible/playbook/__init__.py", > line 229, in run* > * play = Play(self, play_ds, play_basedir)* > * File "/usr/lib/python2.6/site-packages/ansible/playbook/play.py", line > 83, in __init__* > * ds = self._load_roles(self.roles, ds)* > * File "/usr/lib/python2.6/site-packages/ansible/playbook/play.py", line > 327, in _load_roles* > * roles = self._build_role_dependencies(roles, [], self.vars)* > * File "/usr/lib/python2.6/site-packages/ansible/playbook/play.py", line > 192, in _build_role_dependencies* > * role_vars = utils.combine_vars(vars_data, role_vars)* > * File "/usr/lib/python2.6/site-packages/ansible/utils/__init__.py", line > 1008, in combine_vars* > * return dict(a.items() + b.items())* > *AttributeError: 'list' object has no attribute 'items'* > > Perhaps I am abusing syntax here though ... > > Thanks > Albion > -- > 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] <javascript:>. > To post to this group, send email to [email protected]<javascript:> > . > For more options, visit https://groups.google.com/groups/opt_out. > > -- 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]. For more options, visit https://groups.google.com/groups/opt_out.
