Reputation: 857
Is it possible for ansible-playbook
to read a playbook from the standard input? I thought maybe dash (-) would be a way to specify stdin
, like it does in the cat
command and I tried:
$ ansible-playbook -
But it fails with:
ERROR! the playbook: - could not be found
Upvotes: 12
Views: 4071
Reputation: 33223
The thing you are looking for is /dev/stdin
, which acts like a file but, as its name implies, is the stdin of the current process.
$ 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
Upvotes: 19