# Passing encrypted variables to Script module via arguments.

**URL:** <https://forum.ansible.com/t/passing-encrypted-variables-to-script-module-via-arguments/23993>\
**Category:** Ansible Project\
**Tags:** vmware\
**Created:** [March 17, 2017, 9:49am UTC](https://forum.ansible.com/t/passing-encrypted-variables-to-script-module-via-arguments/23993 "2017-03-17T09:49:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rajesh\_N](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Rajesh\_N](https://forum.ansible.com/u/Rajesh_N)\
**Post date:** [March 17, 2017, 9:49am UTC](https://forum.ansible.com/t/passing-encrypted-variables-to-script-module-via-arguments/23993/1 "2017-03-17T09:49:44Z")

</div>

Folks,  
I have a file encrypted with Vault containing the logins for my VMware environment.  
I also have a powershell script to execute some commands on my VMware environment. From ansible i execute the this file via the script module.  
I now want to pass the encrypted logins to the powershell script as arguments to the script module. From the documentation i see that script module accepts arguments.

Kindly let me know if this is feasible and any examples would be helpful

Regards,  
Rajesh

---

<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 21, 2017, 9:30am UTC](https://forum.ansible.com/t/passing-encrypted-variables-to-script-module-via-arguments/23993/2 "2017-03-21T09:30:14Z")

</div>

Lots of options for doing this.

Have a read of the Vault documentation page: [http://docs.ansible.com/ansible/playbooks\_vault.html](http://docs.ansible.com/ansible/playbooks_vault.html)

I would probably put the vaulted variables into group\_vars so that they apply to whatever group of hosts it makes sense for them to belong to (perhaps development / testing / production) and then just used the vaulted variable names as parameters for the script module. Here’s an example from one of my roles. ‘domain’ and ‘user’ are vaulted variables.

script: setLogonAsAServiceRight.ps1 {{ domain }} {{ user }}

Hope this helps,

Jon
