# Passing extra\_vars via provisioning callback using PowerShell

**URL:** <https://forum.ansible.com/t/passing-extra-vars-via-provisioning-callback-using-powershell/26949>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [March 9, 2018, 7:25pm UTC](https://forum.ansible.com/t/passing-extra-vars-via-provisioning-callback-using-powershell/26949 "2018-03-09T19:25:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![travisk](https://avatars.discourse-cdn.com/v4/letter/t/82dd89/32.png) [@travisk](https://forum.ansible.com/u/travisk)\
**Post date:** [March 9, 2018, 7:25pm UTC](https://forum.ansible.com/t/passing-extra-vars-via-provisioning-callback-using-powershell/26949/1 "2018-03-09T19:25:16Z")

</div>

Hello,

I have a template that needs to be run against Windows hosts that make use the callback URL to initiate the job against them.

This works for that purpose:

Invoke-WebRequest -Method POST -Body @{host\_config\_key=‘\<auth\_key\>’}

However, I also need to pass extra\_vars as a part of the callback. I’ve tried this several ways and I can’t seem to get it right (I assume it’s some kind of syntax or forwarding thing.).

I don’t know if some of the syntax rules outline in the documentation (i.e. escaping spaces) apply to PowerShell or not, but I tried them anyway to no success. Here’s an example of what I’m trying:

$extra\_vars = ‘{"instance\_id" : "12345"}’

$body = @{}  
$body.Add(‘host\_config\_key’, ‘54321’)  
$body.Add(‘extra\_vars’, $extra\_vars)

$response = Invoke-WebRequest -Method POST -Body $body

This will still launch the template, but when I reference the instance\_id var it isn’t defined.

Any help would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [March 12, 2018, 5:40pm UTC](https://forum.ansible.com/t/passing-extra-vars-via-provisioning-callback-using-powershell/26949/2 "2018-03-12T17:40:48Z")

</div>

Can you share both your code and the results you are getting? I’m strugling a bit to understand.

If you are attempting to use say win\_template to create a powershell script then you’ll need to use the {{ }} in your template file so that ansible knows to substitute in the value for the variable name that is inside the {{ }}.

There might be an easier way to do what you want, - you can pass arguments to powershell scripts run via the script module for example

Jon
