global name 'ANSIBLE_VERSION' is not defined

I am getting this error when running ansible 2.1.0.0

An exception occurred during task execution. The full traceback is:

Traceback (most recent call last):

File “/var/folders/c7/wbkyhcfj69dcsvp3464g0knh0000gn/T/ansible_psAqud/ansible_module_blockinfile.py”, line 290, in

main()

File “/var/folders/c7/wbkyhcfj69dcsvp3464g0knh0000gn/T/ansible_psAqud/ansible_module_blockinfile.py”, line 226, in main

if ANSIBLE_VERSION.startswith(‘1.’):

NameError: global name ‘ANSIBLE_VERSION’ is not defined

maybe this issue is happening again?

https://github.com/ansible/ansible/issues/11545

any recomendations on how to fix it?

Thanks!

ANSIBLE_VERSION was removed in 2.1 and all modules that depended on it were fixed in devel, but it seems blockinfile in 2.1 still uses it.

I’ve pushed a fix to stable-2.1 and it should be out in a possible 2.1.1 or eventually in 2.2