'How to run a python script from a ansible playbook

Trying to create a yaml that will run a python script to connect ansible to other software frameworks.

The playbook looks like something along the lines of:

---
- host: all
  tasks:
  - name: Connect to some framework
    script: testscript.py

Is this correct syntax or is there more to add to the yaml file?



Solution 1:[1]

You should probably add the interpreter:

---
- host: all
  tasks:
  - name: Connect to some framework
    script: /path/to/testscript.py
    args:
      executable: /usr/bin/python

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1