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
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
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