Variables not working in playbook

Dear list,

I am a bit stomped. I have the following test playbook:

  % cat test.yml
  - hosts: localhost
    gather_facts: yes
    vars:
      msg: test
    tasks:
      - debug: msg=$msg
      - debug: msg=$ansible_fqdn

You'd think this should yield two debug messages with 'test' and
'localhost', right?

Well, no. Wrong:

  % ansible-playbook test.yml
  PLAY [localhost] **************************************************************

  GATHERING FACTS ***************************************************************
  ok: [localhost]

  TASK: [debug msg=$msg] ********************************************************
  ok: [localhost] => {"msg": "$msg"}

  TASK: [debug msg=$ansible_fqdn] ***********************************************
  ok: [localhost] => {"msg": "$ansible_fqdn"}

  PLAY RECAP ********************************************************************
  localhost : ok=3 changed=0 unreachable=0 failed=0

Could someone please tell me what is going on?

  % ansible-playbook --version
  ansible-playbook 1.3 (devel 0bd5fe9951) last updated 2013/06/15 16:06:49 (GMT +200)

Thanks,

also sprach martin f krafft <madduck@madduck.net> [2013.06.15.1630 +0200]:

    tasks:
      - debug: msg=$msg
      - debug: msg=$ansible_fqdn

You'd think this should yield two debug messages with 'test' and
'localhost', right?

It does, unless you set legacy_playbook_variables=no in ansible.cfg.
Doh!

Sorry for the noise.

If it makes you feel any better I had the exact same issue, I had set it the day before to test and spent 2h trying to figure out the next day when all my older playbooks were breaking.

Ok, not a bug :slight_smile: