Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check Ansible version before Ansible validates task attributes #797

Merged
merged 1 commit into from
Mar 24, 2017

Conversation

fullyint
Copy link
Contributor

@fullyint fullyint commented Mar 23, 2017

Avoids ERROR! 'check_mode' is not a valid attribute for a Task for Ansible < 2.2 (example).

The challenge is that Ansible validates task attributes before running a playbook, before the current version check can run, and even before the callback plugin is processed.

A vars plugin will load before Ansible validates task attributes, so it appeared to be the only option for performing a version check and helpful "please upgrade" message.

This PR adds back a vars plugin as a bit of a hack for the sake of the Ansible version check. Trellis formerly had a vars plugin (removed in #684 and #707).
Edit: Modeled after Ansible's version_compare test.

@swalkinshaw
Copy link
Member

👍

Avoids "ERROR! ‘check_mode’ is not a valid attribute for a Task"
which occurs for Ansible lt 2.2. Ansible validates task
attributes before running a playbook and before loading callback
plugins, so a vars plugin appeared to be the only option for
intercepting the error with a version check and message.
@fullyint fullyint force-pushed the ansible-version-check branch from db3b369 to f5cc228 Compare March 24, 2017 00:31
@fullyint fullyint merged commit a7506ed into master Mar 24, 2017
@fullyint fullyint deleted the ansible-version-check branch March 24, 2017 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants