Why Am I Getting "SyntaxError: invalid syntax" For Some Remote Hosts While Using Ansible ?

Solution Verified - Updated -

Issue

I'm executing a playbook and some hosts are returning a similar error like below:

  File \"/apath/.ansible/tmp/ansible-tmp-1589371940.34-147349447418813\", line 39\r\n    with open(module, 'wb') as f:\r\n            ^\r\nSyntaxError: invalid syntax\r\n"

Environment

Ansible Engine 2.7+

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content