Bug 1130145 - Include statement does not expand variables with rebased ansible 1.6.10
Summary: Include statement does not expand variables with rebased ansible 1.6.10
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: ansible
Version: 20
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Kevin Fenzi
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-08-14 12:35 UTC by Pavel Raiskup
Modified: 2014-12-18 12:20 UTC (History)
4 users (show)

Fixed In Version: ansible-1.7-1.fc20
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-08-14 17:58:00 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

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


Note You need to log in before you can comment on or make changes to this bug.