Just to clarify, this is because the "[" is part of YAML and is not getting parsed as you're expecting. You could probably also just quote the whole line.
On Thu, May 29, 2014 at 11:57 AM, Matt Martz <[email protected]> wrote: > You probably need to change your debug task to look like 1 of the three > examples: > > - debug: var=ansible_date_time.year > > - debug: > var: ansible_date_time['year'] > > - debug: > var: ansible_date_time.year > > -- > Matt Martz > [email protected] > > On May 29, 2014 at 11:52:27 AM, Andrew Cholakian ([email protected]) wrote: > > I've got a particularly vexing bug wrt the date / time helpers. Running the > following: > > - debug: "var=ansible_date_time['year']" > > Does not give me the current year, the variable remains uninterpolated. I've > tried various permutations of quoting, to no avail. The debug output > suspiciously drops a leading [, making me think there's a bug in the ansible > internals when parsing this. Here's the debug output: > > _________________________________________________________ > < TASK: tower-backup | debug var=ansible_date_time'year'] > > --------------------------------------------------------- > \ ^__^ > \ (oo)\_______ > (__)\ )\/\ > ||----w | > || || > > > ok: [ec2-54-86-254-67.compute-1.amazonaws.com] => { > "ansible_date_time[year]": "{{ ansible_date_time[year] }}", > "item": "" > } > -- > 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/d59a51c9-d40c-4063-88a3-3b0235258ba7%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/etPan.538758ec.643c9869.4b11%40mobiletuvix.rackspace.corp. > > 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/CAJQqANfnQNG7BFdAN5hrzaUu31twci1WYxkXnKw%2BnOfB_8eZog%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
