gpt4 book ai didi

debian - 带有需要 tty 的 shell 脚本的 ansible 流水线模式

转载 作者:行者123 更新时间:2023-12-01 12:43:08 78 4
gpt4 key购买 nike

我正在按照 this 的 Backports 部分中的步骤使用 ansible 在 Debian wheezy VM 上安装 node.js 和 npm。 .

以下 playbook 任务过去可以很好地与传统的 ansible ssh 模式配合使用。

- name: install npm
shell: curl https://www.npmjs.org/install.sh | sh creates=/usr/bin/npm

直到我尝试启用 ansible 1.5 的流水线。现在它失败了:
npm-install-18570.sh: 246: npm-install-18570.sh: cannot open /dev/tty: No such device or address

下载的 shellscript install.sh 在第 246 行引用/dev/tty,因此在流水线模式下使用 ansible 执行时失败。

我可以只为这一项任务禁用流水线吗?
还有别的选择吗?”

最佳答案

没有禁用 pipelining 的选项对于单个任务 AFAIK。请记住,Ansible 1.5 仍处于开发阶段。

但是,作为一种解决方法,您可以在通过 pipelining=False 的单独剧本上运行您的任务。环境变量来覆盖您的 ansible.cfg 的值文件:

ansible-playbook -i ./your-inventory-file -e "pipelining=False" your-no-pipeline-playbook.yml

这按照此处的描述(来自 Ansible 文档):

Ansible also allows configuration of settings via environment variables. If these environment variables are set, they will override any setting loaded from the configuration file. These variables are for brevity not defined here, but look in ‘constants.py’ in the source tree if you want to use these. They are mostly considered to be a legacy system as compared to the config file, but are equally valid.



和这里:

https://github.com/ansible/ansible/blob/devel/lib/ansible/constants.py

关于debian - 带有需要 tty 的 shell 脚本的 ansible 流水线模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22442810/

78 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com