On 06. april 2017 11:06, Thad Scalf wrote:
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.

It hasn't.


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:

The action: directive is not part of the ec2_facts module syntax, but Ansible itself.
Using action: has not been recommended/preferred since Ansible 0.8
https://docs.ansible.com/ansible/playbooks_intro.html#action-shorthand

That being said, you error indicate missing tasks: or a indention error.

One example on indention error that trigger the same error message.

- hosts: localhost
  tasks:
- name: Test
  action: debug msg="test"


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?

Why, since that syntax is supported since Ansible 0.8?

--
Kai Stian Olstad

--
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/d72346b5-4f06-56d9-b7a9-8f40259c47a0%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to