- name: Run Python Script with External Functions hosts: localhost gather_facts: no tasks: - name: Ensure required Python packages are installed pip: requirements: /Users/vadimshulkin/playbooks/requirements.txt # Ensure dependencies are installed - name: Run the Python script command: python3 /Users/vadimshulkin/playbooks/scripts/my_script.py register: script_output - name: Show script output debug: msg: "{{ script_output.stdout }}"