Hello All,

I've define one role/tasks/main.yml as below

- name: Include module variables

  include_vars: '{{ module }}.yml'

- include: prereq-{{ module }}-status.yml

I've defined each yml (
prereq-cq-status.yml, prereq-dmgr-status.yml,prereq-ihs-status.yml) in same 
role/tasks

and files are mentioned in roles/vars (cq.yml,dmgr.yml,ihs.yml) 


Note :module defined in inventory

got syntax error, ERROR: file could not read: (role/
tasks/prereq-{{module}}-status.yml)

Can some one help me please.how to fix this

On Sunday, 17 August 2014 15:24:13 UTC+5:30, Akos Vandra wrote:
>
> Hello!
>
> I am trying to include a file based on a variable name like so:
>
> - do preparation stuff
> - include: '{{ include_before_symlink }}'
>   when: '{{ include_before_symlink != None }}'
> - do symlinking
>
> This is to be able to do a yield, similar to this:
>
> - include: deploy_revision
>   vars: 
>     - foo: bar
>     - include_before_symlink: roles/myrole/tasks/before_symlink.yml
>
> Which would execute the deploy_revison task up to the point where it would 
> start executing the before_symlink task file, and then return and finish up 
> the deploy_revision task. Emphasis is that the caller should be able to 
> provide what to do BEFORE the symlinkink.
>
> The error I get is:
>
> akovanm0:water-playbook avandra$ ansible-playbook 
> --private-key=~/.vagrant.d/insecure_private_key -i 
> .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory site.yml 
>  -v
> Traceback (most recent call last):
>   File "/usr/local/Cellar/ansible/1.6.10/libexec/bin/ansible-playbook", 
> line 5, in <module>
>     pkg_resources.run_script('ansible==1.6.10', 'ansible-playbook')
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py",
>  
> line 489, in run_script
>     self.require(requires)[0].run_script(script_name, ns)
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py",
>  
> line 1207, in run_script
>     execfile(script_filename, namespace, namespace)
>   File 
> "/usr/local/Cellar/ansible/1.6.10/lib/python2.7/site-packages/ansible-1.6.10-py2.7.egg/EGG-INFO/scripts/ansible-playbook",
>  
> line 317, in <module>
>     sys.exit(main(sys.argv[1:]))
>   File 
> "/usr/local/Cellar/ansible/1.6.10/lib/python2.7/site-packages/ansible-1.6.10-py2.7.egg/EGG-INFO/scripts/ansible-playbook",
>  
> line 257, in main
>     pb.run()
>   File 
> "/usr/local/Cellar/ansible/1.6.10/lib/python2.7/site-packages/ansible-1.6.10-py2.7.egg/ansible/playbook/__init__.py",
>  
> line 289, in run
>     play = Play(self, play_ds, play_basedir, 
> vault_password=self.vault_password)
>   File 
> "/usr/local/Cellar/ansible/1.6.10/lib/python2.7/site-packages/ansible-1.6.10-py2.7.egg/ansible/playbook/play.py",
>  
> line 152, in __init__
>     self._tasks      = self._load_tasks(self._ds.get('tasks', []), 
> load_vars)
>   File 
> "/usr/local/Cellar/ansible/1.6.10/lib/python2.7/site-packages/ansible-1.6.10-py2.7.egg/ansible/playbook/play.py",
>  
> line 588, in _load_tasks
>     loaded = self._load_tasks(data, mv, default_vars, included_sudo_vars, 
> list(included_additional_conditions), original_file=include_filename, 
> role_name=new_role)
>   File 
> "/usr/local/Cellar/ansible/1.6.10/lib/python2.7/site-packages/ansible-1.6.10-py2.7.egg/ansible/playbook/play.py",
>  
> line 588, in _load_tasks
>     loaded = self._load_tasks(data, mv, default_vars, included_sudo_vars, 
> list(included_additional_conditions), original_file=include_filename, 
> role_name=new_role)
>   File 
> "/usr/local/Cellar/ansible/1.6.10/lib/python2.7/site-packages/ansible-1.6.10-py2.7.egg/ansible/playbook/play.py",
>  
> line 576, in _load_tasks
>     (k,v) = t.split("=", 1)
> ValueError: need more than 1 value to unpack
> akovanm0:water-playbook avandra$
>
> Thanks for your help,
>   Akos vandra
>

-- 
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/fef9032c-7066-4061-bcb8-30acf59416f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to