Ansible supports inventory directories. If you place both ec2.py and digital_ocean.py in a directory called "inventory", you could then use:
ansible -i ~/ansible/inventory -u my-special-user -f 20 -s \* -m shell -a 'ps' You could then also call each inventory script separately if you needed. On Wed, Dec 10, 2014 at 4:48 PM, Florin Andrei <[email protected]> wrote: > New to Ansible, just testing it. For now, I'm using dynamic inventory > scrips, and I'm trying to run simple commands on all hosts, via ansible. > > I've setup ec2.py and digital_ocean.py in ~/ansible/, and both scripts > work just fine. Provisioned with the correct credentials, if I run either > script manually, I get the correct list of assets from those two cloud > providers, respectively. > > If I run Ansible with just one script (either ec2.py or digital_ocean.py) > then that also works well: > > ansible -i ~/ansible/ec2.py -u my-special-user -f 20 -s \* -m shell -a 'ps' > > ansible -i ~/ansible/digital_ocean.py -u my-special-user -f 20 -s \* -m > shell -a 'ps' > > But if I try to do just -i ~/ansible/ (hoping to use both inventory > scripts in a concatenated list) then it doesn't work. Spying the process > list with pstree, I've noticed that ansible runs digital_ocean.py --host > with all the hosts from the EC2 list. That can't be right. No wonder it > doesn't work then. > > What is the correct way to use several dynamic inventory scripts at once > for something simple like -m shell -a 'ps'? > > P.S.: > > If I run ./digital_ocean.py --list manually, it just throws a JSON with > my hosts. But if I do ./ec2.py --list manually, then it generates first > the "_meta": tag, and then throws a list similar to the DO script. Not > sure if this is relevant to the main issue, I just thought I should mention > it. > > -- > 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/f1717237-2b88-4b50-b42d-b19f0ae8964a%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/f1717237-2b88-4b50-b42d-b19f0ae8964a%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Matt Martz @sivel sivel.net -- 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/CAD8N0v_q_jrsOndEKtYuZ-xzj%3DU-KmQJB1dppQGg8%2B6JxwXCAg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
