I'm not sure I'm following, can you clarify exactly what your issue is?

The start of this thread was about how to pass variables.



On Sat, Nov 15, 2014 at 5:23 PM, Toshio Kuratomi <[email protected]>
wrote:

> What does your execute shell look like with Damir's workaround?  Were
> you also able to see the values of the substitution has extra quotes
> in that case or is it the same traceback but not necessarily the same
> place that quotes are being mismatched?
>
> -Toshio
>
> On Sat, Nov 15, 2014 at 5:15 AM, jonten <[email protected]> wrote:
> > Hi,
> >
> > Sorry for hi-jacking this old thread but I'm experiencing exactly the
> same
> > problems as the original poster Naween. Have also tried Damirs workaround
> > without success, just get the same result as when not using a vars file.
> >
> > I'm running the following versions of Ansible and other related software:
> >
> > OS: CentOS 6.5
> > Ansible verision:ansible-1.7.2-2.el6.noarch (from epel repo)
> > Python Jinja version: python-jinja2-2.2.1-1.el6.rf.x86_64 (think it was
> from
> > rpmbone because of dependency trouble with other jinjas)
> > Jenkins version: jenkins-1.499-1.1.noarch
> >
> > I tried this with ansible-1.7.0-1.el6.noarch also from epel repo with the
> > same result. Everything works great with dynamic extra-vars variables
> from
> > the command line but not from Jenkins.
> >
> > Best regards,
> >
> > //Jon
> >
> >
> > On Sunday, September 21, 2014 9:34:45 PM UTC+2, Michael DeHaan wrote:
> >>
> >> What version of Ansible are you using?
> >>
> >>
> >>
> >> On Sat, Sep 20, 2014 at 4:40 AM, Naween Ghimire <[email protected]>
> >> wrote:
> >>>
> >>> 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.
> >>
> >>
> > --
> > 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/ebe17377-536f-48d6-a570-1af4150ab75c%40googlegroups.com
> .
> >
> > 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/CAG9juEqT_7yNCyFg%2BCO15EyhNTR7wiqE8hLoPpzUHCLdKrLHAQ%40mail.gmail.com
> .
> 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%2BnsWgyntMPSvc1W1PM_pDBQrxVGc9hY%3D6xptt2KkAaGiRwwxw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to