No, it shouldn't.

For one, the YAML is conceptually mixed up a bit:

- vars:
    - playbook: "file"

  include: "{{ playbook }}.yml"


Perhaps you meant a task include, but basically there's a lot of made-up
syntax here and I can't make sense of it.

It may be easier to step back and ask what you are trying to do, maybe in a
new thread, and we could help you model it.






On Thu, Sep 4, 2014 at 3:44 PM, Wolfgang Ziegler <[email protected]> wrote:

> Looks like this is about task include. I did something similar with a
> playbook include and it used to work in <1.7. However, after updating to
> 1.7.1 it fails now (with the same error). Is the following playbook
> supposed to work?
>
> - vars:
>     - playbook: "file"
>
>   include: "{{ playbook }}.yml"
>
>
>
>
>
>
> Am Montag, 18. August 2014 14:27:49 UTC+2 schrieb Michael DeHaan:
>>
>> Excellent!  Thanks for testing!
>>
>>
>> On Sun, Aug 17, 2014 at 9:26 AM, Akos Vandra <[email protected]> wrote:
>>
>>> Working on 1.7.1
>>>
>>> On 17 August 2014 15:09, Michael DeHaan <[email protected]> wrote:
>>> > If you see that traceback in 1.7.1 (the latest release) please do file
>>> a bug
>>> > in GitHub so we can improve the split or make a better error message.
>>> > Let us know!
>>> >
>>> > As a sidenote, this syntax is not neccessary, so a quick primer on
>>> > conditionals:
>>> >
>>> > - include: '{{ include_before_symlink }}'
>>> >   when: '{{ include_before_symlink != None }}'
>>> >
>>> > At a basic level, you can drop the Jinja2 brackets, as that will
>>> result in a
>>> > string value that you don't want:
>>> >
>>> > - include: "{{ foo }}"
>>> >   when: include_before_symlink != None
>>> >
>>> > OR (more simply, if you wish to only define it when it is to be used)
>>> >
>>> > - include: "{{ foo }}"
>>> >   when: include_before_symlink is defined
>>> >
>>> > OR (if you just want to reply on the true/false value)
>>> >
>>> > - include: "{{ foo }}"
>>> >   when: include_before_symlink | default(False)
>>> >
>>> > Defaults can also set in roles/rolename/defaults/main.yml, which make
>>> this
>>> > even nicer:
>>> >
>>> > - include: "{{ foo }}"
>>> >   when: include_before_symlink
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > On Sun, Aug 17, 2014 at 5:54 AM, Akos Vandra <[email protected]> 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/
>>> 4cb8ba86-a8be-4dc0-a73e-c0a98f4ba9f8%40googlegroups.com.
>>> >> For more options, visit https://groups.google.com/d/optout.
>>> >
>>> >
>>> > --
>>> > 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/CA%
>>> 2BnsWgzn61CdJ3%2B4T71%3DPnf2QX_4Xh-BggUHePgSM5egCL9woQ%40mail.gmail.com.
>>> >
>>> > For more options, visit https://groups.google.com/d/optout.
>>>
>>> --
>>> 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/CAHHcNoepfZ7LsGP0DTRz94iXsW-
>>> TzOiJ_pZAGS7eub-GzfRXTQ%40mail.gmail.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
> 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/4db0c81d-ea5d-42cc-8e49-8e23be2dae5f%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/4db0c81d-ea5d-42cc-8e49-8e23be2dae5f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CA%2BnsWgz4drzxHDUFNiygR_%2BYYDaQ%3DrFy7w7q60-YfxCvFwHiyg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to