Passing encrypted variables to Script module via arguments.

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

Lots of options for doing this.

Have a read of the Vault documentation page: 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