Ansible does already have a concept of dynamic inventory sources that has somewhat reserved that phrase:
http://docs.ansible.com/intro_dynamic_inventory.html If a bit of tweaking is necessary to allow for reading files from named pipes, I'm ok with it -- provided everything else works as advertised. On Sat, Sep 13, 2014 at 4:42 PM, Greg Andrews <[email protected]> wrote: > To clarify, process substitution is a Bash shell syntax that replaces the > <( ... ) with a filename, but that filename is a named pipe (aka a FIFO) > that a sub-shell has opened for writing by the commands inside the > parentheses. The command that you pass this to (in Paul's example, > ansible-playbook) must open the given "file" and read it from start to end > without trying to seek back and forth. > > I tried this with the 'ansible' command a while ago and it failed the same > way. I assumed that the code wanted to do seeks around the file rather > than just read it all, and that was the reason for the failure. I didn't > investigate any deeper. > > I thought it could be a nice way to accommodate dynamic inventory sources, > but there might be a good reason you wouldn't want to support it. > > -Greg > > > On Fri, Sep 12, 2014 at 3:12 PM, Paul Smith <[email protected]> wrote: > >> Does Ansible not support bash's process substitution >> <http://tldp.org/LDP/abs/html/process-sub.html>? >> >> My project maintains separate inventory files, and there are some >> playbooks that need hosts from certain combinations of them. Instead of >> having pre-concatenated files that could go out of sync, I'd like to do >> something like: >> >> $ ansible-playbook -i <(cat inventorya inventoryb) playbook.yml >> >> I get this error though when I try it: >> >> ERROR: provided hosts list is empty >> >> I haven't looked at the Ansible source, but this may be because process >> substitution uses an fifo under the hood, and Ansible may be strictly >> looking for a file, but this is just wild speculation. >> >> (Ansible 1.7.1) >> >> -Paul >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ansible Project" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/8c342e6e-0605-4f8a-be47-bbd8491504bf%40googlegroups.com >> <https://groups.google.com/d/msgid/ansible-project/8c342e6e-0605-4f8a-be47-bbd8491504bf%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/CAPdwyX6YUF8fjYG42Y7pZSuYZ5hySGbyGJ-8_HYjfe3DV%2Bt%3Dxg%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CAPdwyX6YUF8fjYG42Y7pZSuYZ5hySGbyGJ-8_HYjfe3DV%2Bt%3Dxg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgzonkF7sA4bXoT0FKCtFhiQP1mk6Gi4_625mTf1Vg7n1g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
