Hi,
I have developed a module in BASH, and I am able to run in using external
arguments given from command line:
[root@ansible ansible]#* ansible ap0tv01ras02pbsw0 -m
ansible_startBladeAgent -a "serverName=ap0tv01ras02pbsw0v00
platformVersion=1.0.9"*
*ap0tv01ras02pbsw0 | success >> {*
* "changed": false, *
* "msg": "Server ap0tv01ras02pbsw0v00 already running"*
*}*
I would like to start this module without specifying the arguments in the
command line, so i have set inside /etc/ansible/hosts file those variables
for that specific host:
hosts:
ap0tv01ras02pbsw0 serverName=ap0tv01ras02pbsw0v00 platformVersion=1.0.9
My question is - how do I access those variables from my script?
parsing the command line vars inside my BASH script is done by:
eval $(sed -e
"s/\s?\([^=]+\)\s?=\s?\(\x22\([^\x22]+\)\x22|\x27\([^\x27]+\)\x27|\(\S+\)\)\s?/\1='\2'/p"
$1)
and works fine.
Thanks
--
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/50d9fe69-8286-4292-aada-09a437dba39f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.