Hi All,

I am trying to run an ansible playbook from jenkins build to have jenkins 
trigger my ansible execution.

As part of my ansible-playbook run i need to pass extra-vars to the 
playbook during execution.

eg:

ansible-playbook -i $inventory-file $role-name 
--extra-vars"var1=$var1-value, var2=$var2-value"

when i put this line in the execute shell of jenkins the double quotes are 
evaluated and so aren't available to the ansible-playbook command, so i 
escaped them as follows:

ansible-playbook -i $inventory-file $role-name 
--extra-vars\"var1=$var1-value, var2=$var2-value\"

But if i do this, 

shell adds extra quotes around it as below:

ansible-playbook -i <inventory-file-name> <role-name> --extra-vars ' 
"var1=var1-value,' var2=var2-value, 'var3=var3-value " '

And ansible give the following error:


Traceback (most recent call last):

  File "/usr/local/bin/ansible-playbook", line 317, in <module>

    sys.exit(main(sys.argv[1:]))

  File "/usr/local/bin/ansible-playbook", line 148, in main

    extra_vars = utils.combine_vars(extra_vars, 
utils.parse_kv(extra_vars_opt))

  File "/Library/Python/2.7/site-packages/ansible/utils/__init__.py", line 
621, in parse_kv

    vargs = split_args(args)

  File "/Library/Python/2.7/site-packages/ansible/utils/splitter.py", line 
148, in split_args

    raise Exception("error while splitting arguments, either an unbalanced 
jinja2 block or quotes")

Exception: error while splitting arguments, either an unbalanced jinja2 
block or quotes


Has anyone come across such a situation before ?

-- 
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/a97b244f-f05b-4c72-a95a-ad48974c853d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to