Bug 1130145

Summary: Include statement does not expand variables with rebased ansible 1.6.10
Product: [Fedora] Fedora Reporter: Pavel Raiskup <praiskup>
Component: ansibleAssignee: Kevin Fenzi <kevin>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: athmanem, kevin, kupo, maxim
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ansible-1.7-1.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-14 17:58:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Pavel Raiskup 2014-08-14 12:35:05 UTC
With somthing like that:

=> test.yml
 | - name: test
 |   hosts: localhost
 |   remote_user: root
 |   gather_facts: False
 |
 |   vars:
 |     test_var: /tmp
 |
 |   tasks:
 |   - include: "{{ test_var }}/blah.yml"

The command `ansible-playbook ./test.yml` throws traceback:

 | Traceback (most recent call last):
 |   File "/bin/ansible-playbook", line 317, in <module>
 |     sys.exit(main(sys.argv[1:]))
 |   File "/bin/ansible-playbook", line 257, in main
 |     pb.run()
 |   File "/usr/lib/python2.7/site-packages/ansible/playbook/__init__.py",
 |     line 289, in run play = Play(self, play_ds, play_basedir,
 |     vault_password=self.vault_password)
 |   File "/usr/lib/python2.7/site-packages/ansible/playbook/play.py", line
 |     152, in __init__ self._tasks      =
 |     self._load_tasks(self._ds.get('tasks', []), load_vars)
 |   File "/usr/lib/python2.7/site-packages/ansible/playbook/play.py", line
 |     577, in _load_tasks (k,v) = t.split("=", 1)
 | ValueError: need more than 1 value to unpack

This does not happen with 1.3 version which was rebased in stable fedora 20
to ansible 1.6.

Comment 1 Kevin Fenzi 2014-08-14 15:42:50 UTC
Yeah, this was a bug found after 1.6.10 release. 

Can you please try 1.7 that is in updates-testing?

yum --enablerepo=updates-testing update ansible

The problem is the spaces... so: 
- include: "{{ test_var }}/blah.yml"
will fail, but: 
- include: "{{test_var}}/blah.yml"
will work. 

This should be fixed in 1.7

Comment 2 Pavel Raiskup 2014-08-14 17:58:00 UTC
Karma given, thanks.
https://admin.fedoraproject.org/updates/FEDORA-2014-9150/ansible-1.7-1.fc20

Comment 3 Pavel Raiskup 2014-12-18 12:20:15 UTC
FWIW, that happened again in (EPEL) ansible-1.8.1-1, fixed by
ansible-1.8.2-1.el7.noarch.

Pavel