在 Ansible 中运行带参数的 Python 脚本

Daw*_*y33 6 python ansible

我想从 ansible playbook 内部运行带有输入参数的 Python 脚本。我该怎么做?

我尝试过command,但它似乎不需要任何输入参数。我也尝试过script,但似乎只考虑 bash 脚本。

PS:我将输入参数视为--extra-vars.

Daw*_*y33 7

我能够使用以下语句运行该脚本:

- name: Run Py script
  command: /path/to/script/processing.py {{ N }} {{ bucket_name }}
  become: yes
  become_user: root
Run Code Online (Sandbox Code Playgroud)

这解决了问题。