我想用 Ansible 运行安装程序脚本。安装程序脚本会提示一些响应,并且需要以 root 权限运行。
这是我的 Ansible 任务的本质:
- expect:
become: yes
become_method: sudo
command: "installer.bin"
echo: yes
responses:
"Choose the appropriate installation or upgrade option.": "2"
"Where should the software be installed?": "/opt/newsoftware/"
我原以为这会起作用,但我得到了错误
fatal: [127.0.0.1]: FAILED! => {"changed": false, "failed": true, "msg": "unsupported parameter for module: become_method"}
如果我省略“become_method”,则会收到此错误:
fatal: [127.0.0.1]: FAILED! => {"changed": false, "failed": true, "msg": "unsupported parameter for module: become"}
我的 Ansible 是 2.1.1.0 版