【发布时间】:2019-01-03 20:06:41
【问题描述】:
在使用 ansible 滚动重启集群时,我想运行 python 脚本来验证重启后没有任何问题。所以我正在尝试使用 ansible 运行传递参数的 python 脚本。下面是我使用它失败的代码
错误!此任务“python”有额外的参数,仅允许在以下模块中使用:command、win_command、shell、win_shell、script、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
【问题讨论】:
-
为了以后参考,当您将预先格式化的代码粘贴到帖子中时,请立即选择它并键入 Ctrl+K 或单击界面中的
{}按钮。这将正确格式化代码。 -
当然谢谢。下次会这样做