Re: [ansible-project] How to pass command line arg as input for dynamic-inventory executable program during ansible-playbook launch

2016-03-20 Thread Benjamin Redling
On 2016-03-20 12:18, Naren wrote:
> Environment variable kind of solution is good as long as I call my 
> playbooks from console. But when it comes to automation by integrating with 
> external systems; the inventory generator/builder should be good enough to 
> pull inventory artifacts from database, REST APIs,...
> 
> All I need is something like
> 
> ansible-playbook -i dynamicInventory.py --script-args "location=chennai 
> region=south" my_playbook.yml
> 
> here '--script-args' helps dyamicInventory.py program to pull inventory 
> artifacts for specified location and region from some datastore

What aspect of automation keeps you from setting environment variables?
Where is the difference between calling from console and calling from a
script?

E.g.,

SCRIPTARGS="location=chennai region=south" bash -c 'ansible-playbook -i
dynamicInventory.py  my_playbook.yml'

When you evaluate SCRIPTARGS inside dynamicInventory.py I don't see
where the difference is compared to your "--script-args" -- apart from
the syntax.

Regards,
Benjamin
-- 
FSU Jena | JULIELab.de/Staff/Benjamin+Redling.html
vox: +49 3641 9 44323 | fax: +49 3641 9 44321

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/56EE8E3E.6070506%40uni-jena.de.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] How to pass command line arg as input for dynamic-inventory executable program during ansible-playbook launch

2016-03-20 Thread Naren
Environment variable kind of solution is good as long as I call my 
playbooks from console. But when it comes to automation by integrating with 
external systems; the inventory generator/builder should be good enough to 
pull inventory artifacts from database, REST APIs,...

All I need is something like

ansible-playbook -i dynamicInventory.py --script-args "location=chennai 
region=south" my_playbook.yml

here '--script-args' helps dyamicInventory.py program to pull inventory 
artifacts for specified location and region from some datastore

On Sunday, 20 March 2016 09:35:03 UTC+5:30, Brian Coca wrote:
>
> there is no way to do what you ask, options for dynamic inventory are set 
> either in configuration files or environment variables.
>
>
> --
> Brian Coca
>

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c1d667e9-0aaf-4342-b55a-c4fc7869b7e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] How to pass command line arg as input for dynamic-inventory executable program during ansible-playbook launch

2016-03-19 Thread Brian Coca
there is no way to do what you ask, options for dynamic inventory are set
either in configuration files or environment variables.


--
Brian Coca

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CACVha7fqkBT1d0HVX5KRhCrgSi7CXcrfp2J2FUT79bZpYnoNnA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] How to pass command line arg as input for dynamic-inventory executable program during ansible-playbook launch

2016-03-19 Thread Naren
dynamic inventory can be achieved by 

ansible-playbook -i dynamicInventory.py myplaybook.yml

in case I need to pass some dynamic input to the dynamicInventory.py 
program itself, how can I do that. Command line argument is not working 
when it coupled with ansible-playbook command

Any suggestions


-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0c3fc4d6-fd3e-489b-bf1b-8aad030f9e4b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.