strange behaviour with block statement in ansible 2.0

33 views
Skip to first unread message

Ulrich Hochholdinger

unread,
Feb 27, 2016, 2:21:30 PM2/27/16
to Ansible Project
Hi,
I'm experiencing a strange phenomenon with the block statement. If I rearrange a when statement I get syntax error. But the data-structure of both playbooks is the same:

Play that works:

---
- hosts: localhost
  connection: local
  tasks:
  - block:
      - debug: msg="The Message"
    when: true


Same play only lines resorted throws error:
The "with" line arranged directly under the "block" line. Since it's a dictionary there should be no difference?

---
- hosts: localhost
  connection: local
  tasks:
  - block:
    when: true
      - debug: msg="The Message"


============================= output ======================
uhochholdinger@xelo:~$ ansible-playbook -i localhost, block_test.yml 
ERROR! Syntax Error while loading YAML.


The error appears to have been in '/home/uhochholdinger/block_test.yml': line 7, column 14, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

    when: true
      - debug: msg="The Message"
             ^ here
===========================================================


Bug or feature?

Cheers
      Ulli

PS:
uhochholdinger@xelo:~$ ansible --version
ansible 2.0.0.2

Ulrich Hochholdinger

unread,
Feb 27, 2016, 2:29:24 PM2/27/16
to Ansible Project
Ignore the report, I found the error by myself ;-/
No bug! No feature!

cheers 
     Ulli
Reply all
Reply to author
Forward
0 new messages