We are upgrading from ansible 2.1.0 to 2.2.2.0 and our syntax validation tests are failing on the ec2_facts module. Syntax for using ec2_facts has changed.
To test syntax, we use: ansible-playbook --syntax-check --list-tasks -i localhost <playbook>.yml Up to version 2.2.1.0 the following play would validate: > - name: Gather ec2 metadata > action: ec2_facts As of 2.2.2.0 this play now returns the following error: > ERROR! 'action' is not a valid attribute for a Play > The error appears to have been in 'test-play.yml': line 2, column 5, but > may > be elsewhere in the file depending on the exact syntax problem. > The offending line appears to be: > --- > - name: Gather ec2 metadata > ^ here In 2.2.2.0 the following play will validate: > - name: Gather ec2 metadata > ec2_facts: During the transition we need to support both sets of syntax. How can I conditionally include the pre-2.2.2.0 syntax for lower version environments and 2.2.2.0 syntax for newer environments? My first unsuccessful attempt was the following: > - name: Gather ec2 metadata > action: ec2_facts > when: ansible_version < 2.2.2.0 - name: Gather ec2 metadata > ec2_facts: > when: ansible_version >= 2.2.2.0 Any thoughts on version conditional syntax are much appreciated. Thanks, Thad > -- 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/59800187-2247-443e-8e81-e3a2d8e64170%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
