[英]ansible playbook errors out while trying to to run python script
在使用ansible進行群集的滾動重啟時,我想運行python腳本來驗證重啟后回來沒有任何問題。 所以我試圖運行使用ansible傳遞參數的python腳本。 以下是我正在使用的代碼失敗
錯誤! 此任務“ python”具有額外的參數,僅在以下模塊中允許:命令,win_command,shell,win_shell,腳本,include,include_vars,include_tasks,include_role,import_tasks,import_role,add_host,group_by,set_fact,raw,meta
- hosts: tag_name
gather_facts: yes
become: true
serial: 1
tasks:
- name: execute python script
local_action: python script.py -r us-east-1,us-west-2 -n tag -e test -s tag -k "pemfile" -u ec2-user
我相信該錯誤是正確的,因為“命令”和“外殼”是您可以為其指定參數的兩個最常見的模塊。 要在帶有參數的本地主機上執行python腳本,請使用“ command”和“ local_action”,如下所示。
local_action: command python script.py -r us-east-1,us-west-2 -n tag -e test -s tag -k "pemfile" -u ec2-user
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.