Skip to content

Instantly share code, notes, and snippets.

@riton
Last active January 26, 2016 11:28
Show Gist options
  • Save riton/b393a2942b859be666e7 to your computer and use it in GitHub Desktop.
Save riton/b393a2942b859be666e7 to your computer and use it in GitHub Desktop.
Ansible read inventory from FileDescriptor
#!/bin/bash
for host in a b c d e
do
echo "host${host}"
done
# /usr/bin/ansible --version
# ansible 1.5.4
$ /usr/bin/ansible -i <(./cmdb.sh) all --list-hosts
hosta
hostb
hostc
hostd
hoste
# ./ansible --version
# ansible 1.9.4
$ ./ansible -i <(./cmdb.sh) all --list-hosts
No hosts matched
# With comma after the ()
$ ./ansible -i <(/tmp/cmdb.sh), all --list-hosts -vvv
/proc/self/fd/11
# ansible --version
# ansible 2.0.0.1
$ ansible -i <(./cmdb.sh) all --list-hosts
ERROR! ERROR! the file_name '/proc/self/fd/11' does not exist, or is not readable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment