是否可以ansible-playbook从标准输入中读取剧本?我以为连字符(-)可能是一种指定方式stdin,就像cat命令中那样,我尝试过:
$ ansible-playbook -
Run Code Online (Sandbox Code Playgroud)
但是它失败了:
ERROR! the playbook: - could not be found
Run Code Online (Sandbox Code Playgroud)
您正在寻找的是/dev/stdin,它的作用类似于文件,但是,顾名思义,它是当前进程的标准输入。
$ ansible-playbook -i localhost, -c local /dev/stdin <<'FOO'
- hosts: all
tasks:
- debug: msg="hello from stdin"
FOO
PLAY [all] *********************************************************************
TASK [Gathering Facts] *********************************************************
ok: [localhost]
TASK [debug] *******************************************************************
ok: [localhost] =>
msg: hello from stdin
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
555 次 |
| 最近记录: |