Just so that we are clear. Are your files really named with a .xml extension? It was it just a typo and you meant .yml?
.yml is the appropriate file extension. In general it is not straightforward to get var expansion in the name of a task, mainly due to scope. I would however expect defaults and cars to be in the same scope, but without the code in front of me I can't say. Although in general is recommend staying away from cars in the task names. On Tuesday, February 10, 2015, Walter Dolce <[email protected]> wrote: > Hi, > > I've fairly new to Ansible and I've been trying things out with it. > I'm trying to write a simple playbook. As I'd like to have the ability to > [let others] decide what to put in some vars and by following the docs on > vars override rules I came up with something like the following: > > roles/ > php-composer/ > defaults/main.xml > tasks/main.xml > > > Where defaults/main.xml contains: > > --- > composer_destination: ./ > > And one of the tasks in tasks/main.xml contains: > > --- > - name: install composer to "{{ composer_destination }}" > command: chdir={{ composer_destination }} php installer > when: is_composer_installer_downloaded and > is_composer_installer_downloaded|success > > When I run the above, the output is: > > TASK: [php-composer | install composer to "{{ composer_destination }}"] > ******* > > But if I change/move the main.xml from defaults/ to vars/ I get the > variable "expanded", like so: > > TASK: [php-composer | install composer to > "/the/directory/specified/in/vars_mainxml/"] ******* > > Is this expected? > If so, how can I always get a variable "expanded" in the name definition > of a task? > > I ask as I'm looking forward to write a reusable and configurable playbook > but I would also like to always have the variable meant to give the > destination directory outputted when performing a run like in the latter > output above. > > Thank you in advance, > Walter > > -- > 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] > <javascript:_e(%7B%7D,'cvml','ansible-project%[email protected]');> > . > To post to this group, send email to [email protected] > <javascript:_e(%7B%7D,'cvml','[email protected]');>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/60ed7e76-9978-4abf-b8a6-924889842b5a%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/60ed7e76-9978-4abf-b8a6-924889842b5a%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Matt Martz @sivel sivel.net -- 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/CAD8N0v9sd%3DAfv_UdiAkrrr0E9md7GjKif-ikoJ7dMm1h_%3DpVOg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
