test_package/run_python_script.yml

24 lines
573 B
YAML

- name: Run Python Script with External Functions
hosts: localhost
gather_facts: no
tasks:
- name: Copy requirements.txt to remote host
copy:
src: ./requirements.txt # Ensure this exists locally
dest: /tmp/requirements.txt
- name: Install dependencies from copied requirements.txt
pip:
requirements: /tmp/requirements.txt
- name: Run the Python script
command: python3 scripts/my_script.py
register: script_output
- name: Show script output
debug:
msg: "{{ script_output.stdout }}"